Automation 101 with Google Apps Script

Last year, while I was interning at Hordanso LLC, my manager asked me to learn Google Apps Script. I had never heard of it before or experienced its capabilities, as my primary stack has always been Flutter. Fast forward a year later, a friend mentioned that he wanted to send auto-generated emails in response to forms filled out by his users. I decided to look into how this could be done and discovered the easiest automation tool for the job—Google Apps Script. I decided to play around with it and document my learnings. INTRODUCTION In this first course, we will be learning the following: Introduction to Google Apps Script. How to Open the Script Editor in Google Sheets, Docs, or Forms. Understanding the Script Editor Interface Your First Script: Hello World How to Run a Script and View Logs What is Google Apps Script, and why is it important? Google Apps Script is a free cloud-based scripting language developed by Google. It allows you to automate, customize, and extend Google Workspace apps like Google Sheets, Docs, Slides, Forms, Gmail, Calendar, and more. It is based on modern JavaScript. In other words, if you are familiar with the basic syntax of JavaScript you are already 60% ready to build your very first application Unlike traditional programming, Apps Script runs entirely on Google's servers, meaning you don’t need to install anything locally. You write your code in the browser, and it integrates seamlessly with Google’s cloud apps. Why is it important, and what can it be used for? It is being said that when the purpose of a thing is not known, abuse is very inevitable. In other words, if you don't see the need for automation with your traditional system of performing tasks, you will spend more time doing it. Google Apps Script is important for the following reasons: It saves time by automating repetitive tasks Instead of manually copying data, formatting documents, or sending emails, you can write scripts that do these tasks for you automatically. So think of creating a mini-bot that automates complex tasks for you while working with the Google Workspace. It enhances your Google Workspace tools You can add custom menus, create buttons, or build sidebars and dialogs to improve your productivity within Sheets, Docs, or Forms. It connects multiple Google services easily For example, automatically send a calendar invite when a form is submitted, or generate a PDF report from spreadsheet data and email it to your team. It can build custom workflows and apps without needing complex infrastructure Apps Script lets you create lightweight web apps, dashboards, or approval systems that run directly on Google’s cloud. Having said this, what are the things that can be done with Google Apps Script? Automate email sending — send personalized bulk emails or automatic reminders. Manage spreadsheets — import, clean, format data, or generate reports automatically. Create custom Google Forms behavior — auto-respond, route responses, or validate inputs. Schedule and manage calendar events — create, update, or send invites based on data. Generate documents and PDFs — fill templates with data and share them. Build internal tools or web apps — create dashboards, approval workflows, or feedback forms. Automate file management — organize Google Drive files and folders based on rules. Getting Started To get started in your workspace, click on whatever tool you want to use (sheets, docs, or even slides). In the menu bar, click on Extensions, then select Apps Script. Understanding the Google Apps Script Editor To run the Google Apps Script syntax, there is an online editor that helps compile and sync your results. This editor allows you to write, test, and manage your scripts. The beautiful thing about this editor is that you don't have to install any dependencies or have any laptop specifications. Just the internet and adequate permissions, and you are good to go. The editor has the following components: Overview Editor Project History Triggers Executions Project Settings Here is the breakdown of the key components of the editor: File Editor (Code Editor Panel): This is the main area where you write your code. You write your functions here using the JavaScript-like syntax. Each script project starts with a default file named Code.gs. You can add more files using the “+” button (for .gs* or **html files). Use .gs for your main scripts (like .js) and *.html * for building custom dialogs/sidebars. Auto-saves your code as you type. Files Pane (Sidebar on the left): This shows all your project files, including: .gs (script files) .html (for dialogs, sidebars, web apps) appsscript.json (the project’s manifest file) You can edit the names of any of these files by right-clicking. Execution Logs: These logs help monitor your success and failure rate. Think of it like your terminal on your favorite IDE. It shows the function name and execution

May 16, 2025 - 09:48
 0
Automation 101 with Google Apps Script

Last year, while I was interning at Hordanso LLC, my manager asked me to learn Google Apps Script. I had never heard of it before or experienced its capabilities, as my primary stack has always been Flutter. Fast forward a year later, a friend mentioned that he wanted to send auto-generated emails in response to forms filled out by his users. I decided to look into how this could be done and discovered the easiest automation tool for the job—Google Apps Script. I decided to play around with it and document my learnings.

INTRODUCTION

In this first course, we will be learning the following:

  1. Introduction to Google Apps Script.
  2. How to Open the Script Editor in Google Sheets, Docs, or Forms.
  3. Understanding the Script Editor Interface
  4. Your First Script: Hello World
  5. How to Run a Script and View Logs

What is Google Apps Script, and why is it important?

Google Apps Script is a free cloud-based scripting language developed by Google. It allows you to automate, customize, and extend Google Workspace apps like Google Sheets, Docs, Slides, Forms, Gmail, Calendar, and more. It is based on modern JavaScript. In other words, if you are familiar with the basic syntax of JavaScript you are already 60% ready to build your very first application

Unlike traditional programming, Apps Script runs entirely on Google's servers, meaning you don’t need to install anything locally. You write your code in the browser, and it integrates seamlessly with Google’s cloud apps.

Why is it important, and what can it be used for?

It is being said that when the purpose of a thing is not known, abuse is very inevitable. In other words, if you don't see the need for automation with your traditional system of performing tasks, you will spend more time doing it. Google Apps Script is important for the following reasons:

  • It saves time by automating repetitive tasks
    Instead of manually copying data, formatting documents, or sending emails, you can write scripts that do these tasks for you automatically. So think of creating a mini-bot that automates complex tasks for you while working with the Google Workspace.

  • It enhances your Google Workspace tools
    You can add custom menus, create buttons, or build sidebars and dialogs to improve your productivity within Sheets, Docs, or Forms.

  • It connects multiple Google services easily
    For example, automatically send a calendar invite when a form is submitted, or generate a PDF report from spreadsheet data and email it to your team.

  • It can build custom workflows and apps without needing complex infrastructure
    Apps Script lets you create lightweight web apps, dashboards, or approval systems that run directly on Google’s cloud.

Having said this, what are the things that can be done with Google Apps Script?

  • Automate email sending — send personalized bulk emails or automatic reminders.
  • Manage spreadsheets — import, clean, format data, or generate reports automatically.
  • Create custom Google Forms behavior — auto-respond, route responses, or validate inputs.
  • Schedule and manage calendar events — create, update, or send invites based on data.
  • Generate documents and PDFs — fill templates with data and share them.
  • Build internal tools or web apps — create dashboards, approval workflows, or feedback forms.
  • Automate file management — organize Google Drive files and folders based on rules.

Getting Started

To get started in your workspace, click on whatever tool you want to use (sheets, docs, or even slides). In the menu bar, click on Extensions, then select Apps Script.

Understanding the Google Apps Script Editor

To run the Google Apps Script syntax, there is an online editor that helps compile and sync your results. This editor allows you to write, test, and manage your scripts. The beautiful thing about this editor is that you don't have to install any dependencies or have any laptop specifications. Just the internet and adequate permissions, and you are good to go.

The editor has the following components:

  • Overview

  • Editor

  • Project History

  • Triggers

  • Executions

  • Project Settings

Here is the breakdown of the key components of the editor:

File Editor (Code Editor Panel):

This is the main area where you write your code. You write your functions here using the JavaScript-like syntax.

  • Each script project starts with a default file named Code.gs.
  • You can add more files using the “+” button (for .gs* or **html files).
  • Use .gs for your main scripts (like .js) and *.html * for building custom dialogs/sidebars.
  • Auto-saves your code as you type.

Files Pane (Sidebar on the left):
This shows all your project files, including:

  • .gs (script files)
  • .html (for dialogs, sidebars, web apps)
  • appsscript.json (the project’s manifest file) You can edit the names of any of these files by right-clicking.

Execution Logs:

These logs help monitor your success and failure rate. Think of it like your terminal on your favorite IDE. It shows the function name and execution status (success, failure), duration, timestamp, and error messages. You can log your results using

Logger.log("Some message");

Triggers:

Think of it like a gun and a bullet; the gun can be fired at certain times based on the handler. The same applies to triggers too. It allows you to automate tasks based on your preferences, like what happens when a form is submitted._ To use this,

  • Click the clock icon (Triggers) in the left sidebar or use Edit > Triggers.

  • You’ll see the Trigger Dashboard, where you can:

  • Add a new trigger (time-based, event-based, etc.)

  • View and delete existing triggers

  • Set function, frequency, and event source.

Project Settings:

  • Click the gear icon in the left panel or go to Project Settings to:
  • Rename your project
  • Enable or disable Google services
  • Manage deployment settings (when building web apps or add-ons)
  • View script ID for external use (e.g., clasp or GitHub)

Writing your first script: "Hello World!"

If you already code, you would be familiar with the concepts "functions" and "logs." Functions are reusable blocks of code that help perform a specific task. They help organize your code by making it easier to read and preventing any forms of redundancy.
This is how you define a function in Google Apps Script (just like in JavaScript):

function nameOfFunction() {
  // your code goes here
}

There are certain keywords to note here:
_function_: keyword to define a function

_myFunction_: name of the function (you can name it anything, but myFunction is the default).

Logs, on the other hand, help to keep track of events that occur when your code is compiling. It is useful for debugging or checking output. Just like the console.log in JavaScript, Logger.log() is used in Google Apps Script.

Let’s walk through creating and running your very first Google Apps Script.
After opening your Apps Script Editor, delete any default code and paste the following:

function myFirstFunction() {
  Logger.log("Hello, world!");
}
  • At the top of the editor, make sure myFunction is selected in the dropdown.
  • Click the Run ▶️ button.
  • The first time you run a script, Google will ask for permission. Follow the prompts and authorize the script.

  • To see what your script logged:

  • Click View > Logs
    or

  • Use the left sidebar and go to Executions → click on your latest execution → view the logs.

[20xx-xx-xx xx:xx:xx] Hello, world!

With this, you have written your very first Google Apps Script!

I hope you were also able to follow along and practice. In our next tutorial, we will be learning how to use some basic Javascript concepts while building our very first automation script with Google Forms.

See you next time!