Wednesday, December 11, 2013

Google App Script: How to read data from Google Spreadsheet?

Today, I am going to share Google App Script which you can use to read data from Google Spreadsheet. For demonstration purpose I have created a Google spreadsheet with employee records. Each of the rows pertain an employee name, DOB and title.

The purpose is to write the script which will eventually read each of the row and cell value. To start with we need to click on Tools->Script editor

If this is first time you are creating a Google App Script the Project window will appear on the screen; click on Blank Project.

This will open the Script editor window. The script editor window contains the default function myfunction.

We will delete all the code written by default by the Script editor and write following code snippet.

Once we are done with code snippet we will click on Save and save the project with a name.

After that we can click on the run button. GAS (Google App Script) will ask for authorization. Click on Continue to run the authorization.

In the next screen It will Request for Permission as the script is interacting with Google Drive and Google Spreadsheet. Click on Accept.

The Script will run successfully and it will print out the value of each of the cell in the Log. To see the log go to View->Log

Popular Posts

Real Time Web Analytics