A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Hello World in Google Apps Script page! Here, you'll find the source code for this program as well as a description of how the program works.
function helloWorld() {
Logger.log("Hello, World!");
}
Hello World in Google Apps Script was written by:
This article was written by:
If you see anything you'd like to change or update, please consider contributing.
Unlike many languages, Google Apps Script code doesn't need a main
function. In fact, all we have to do is define a function. Google handles what we want to do with the script at runtime.
With that in mind, we can see that we've defined a helloWorld function with syntax similar to JavaScript. In other words, we have a function definition which encloses a code block with braces.
Inside the code block, we have our typical print call. In this case, we leverage the Logger
to do our printing. Then we pass our "Hello, World!" string to the log function, and call it a day.
If we want to run Hello World in Google Apps Script, we actually have to write our scripts using the Apps Script tool. From there, Google has some nice documentation for running them.
Alternatively, we can write scripts locally and upload them to Google Drive. At that point, we can connect the Google Apps Script tool to run our scripts. The link above has directions for that option as well.
If you know of other ways to run Google Apps Script code, let me know in the comments.