Home » Google AppScript6 February 2017

Google AppScript: Create and Write to Google SpreadSheet

This article shows how to create a new Google Sheet and write data into it with Google AppScript. We will also be writing data into existing Google SpreadSheet.

Create a new Google Sheet and write data into it with AppScript

The following function will create a Google Sheet named TestSheet in your Google Drive.
Then, it will add some text in the first three cells of the first row of the spreadsheet.
After that, it will freeze the first row, i.e. the first row will be non-editable.
Then, it will set the fontsize, background color and font color of the first row.

Write data to Google Spreadsheet with AppScript

In the code below, a spreadsheet is opened by its id and then some data is added to that spreadsheet.

To get the spreadsheed id:

– Open Google Spreadsheet
– See the URL in your browser’s address bar
– The URL will be something like this: https://docs.google.com/spreadsheets/d/9tXNUNpM9tXNUNp0BydbYIIYLMxxxxxxxxxx/edit#gid=0
– So, in this case, the spreadsheet id is “9tXNUNpM9tXNUNp0BydbYIIYLMxxxxxxxxxx”

Hope this helps. Thanks.

Google AppScript

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed