How to Write Hello World Function in Apps Script

I love automating things. And one thing I’ve really been into recently is Apps Script by Google, automating a lot of my Google Workspace workflows.

Google Apps Script is a tool that allows you to automate tasks in Google Workspace. As is tradition when learning a new programming language, in our case, Apps Script is to write a simple “hello world” function.

If you are not familiar with it. A “hello world” function is a simple function that prints the text “hello world” to the console. It’s a good way to test your Apps Script installation and to learn the basics of writing functions.

To write a hello world function in Apps Script, follow these steps:

  1. Open the Apps Script editor. You can do this by opening a Google Workspace app (such as Gmail or Docs) and clicking the Tools menu, then Script editor.
  2. In the Apps Script editor, click the File menu, then New, then Project.
  3. In the New Project dialog, give your project a name and click Create.
  4. In the Apps Script editor, click the file to open it.
  5. In the file, add the following code:
function helloWorld() { // Print "hello world" to the console. Logger.log("hello world"); }
  1. Save the file.
  2. To run the hello world function, click the Run button in the Apps Script editor.

The hello world function will print the text “hello world” to the console.

And that’s it! Congratulations! You’ve written your first Apps Script function.

Published by Paul Young-Suk Lee

SWE @lyft. Currently working on data infrastructure

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: