First Apps Script function

Open a Google Sheets document and go to Extensions > Script Editor. This will open the Apps Script editor in a new tab.

In the Apps Script editor, delete any existing code and type the following function. Save the function by clicking on File > Save.

function myFunction() {
  return("Hello, world!");
}

Go back to your Google Sheets document and open a new cell. Type =myFunction() in the cell and press enter.

You should now see “Hello, world!” in the cell.

You have created and executed your first App Script function. You can modify the function to do more advanced tasks such as accessing data from external APIs, sending emails, or performing complex calculations.

Refer to the blog section for inspiration on what you can do with Apps Script.