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()
{
  Browser.msgBox("Hello");

}

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.

6 comments: