Wednesday, August 29, 2012

How to write a script in Google Spreadsheet

If you are new to Google Spreadsheets and you have never written a script before or if you don't know anything about it, then this tutorial will help you to know how you can write a script in a Google Spreadsheet.

Step 1) Open Script Editor:

From "Tools" menu, click on "Script editor..."

Look at the following screenshot:

This will navigate to you to the Script Editor.

Have a look at the screenshot below:

So, now you are ready to write the code in your Google Spreadsheet script editor. You may notice some code already exists on the script, you may delete it and start fresh with your own script.

Now if you want to print "Hello", then make a function in your script with whatever the name you like. I have made the function functionHello(), have a look at the following script:

function functionHello()


Now, copy the above script in your script editor and try to run the function:

And then go to your spreadsheet. You will see the small pop-up window displaying message "Hello":

Hope this helps you to understand how to open script editor and start writing scripts in Google Spreadsheet.


  1. I love it! Thank you for this information!

  2. Thanks it's very helpful.. well done.

  3. Yes , very helpful.
    Ive wondered how to get into scripts for a while now, a little hello world way in is perfect.

    Thank you.

  4. I'm trying to run a script for the first time. When I run the script I get a popup that says "Authorization Required" and then "Sheets List Code needs your permission to access your data on Google." Is this supposed to happen? I'm assuming it's just a security feature/setting but want to be sure.