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:
- 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.
- In the Apps Script editor, click the File menu, then New, then Project.
- In the New Project dialog, give your project a name and click Create.
- In the Apps Script editor, click the script.gs file to open it.
- In the script.gs file, add the following code:
function helloWorld() { // Print "hello world" to the console. Logger.log("hello world"); }
- Save the script.gs file.
- 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.