Google Sheets is an online spreadsheet app that lets you create and format spreadsheets and simultaneously work with other people.
What can this API do?
This API is useful for:
- Managing the worksheets in a Google Sheets file
- Consuming the rows of a worksheet
- Managing cells in a worksheet by position
Common use cases
Common use cases for this API include:
- Computing financial data stored in an inaccessible system
- Presenting statistics to users in a web browser
- Consuming data entered into a spreadsheet by a user
Terminology used in this guide
Throughout this guide, a number of terms are used which are intended to have specific meanings.
Google Sheets document, created with the Google Sheets user interface or with the Google Drive API.
Named collection of cells within a spreadsheet. All spreadsheets must have at least one worksheet, and have one worksheet by default.
Row of cells in a worksheet, represented as a key-value pair, where each key is a column name, and each value is the cell value. The first row of a worksheet is always considered the header row when using the API, and therefore is the row that defines the keys represented in each row.
Single piece of data in a worksheet.
The Google Sheets API lets you read and modify any aspect of a spreadsheet. Spreadsheets have many settings that let you craft beautiful and functional sheets, so the API has many settings too. The API offers two main ways to interact with the spreadsheet:
- Reading/writing cell values only (via the spreadsheets.values collection).
- Reading/writing any aspect of the spreadsheet (via the spreadsheets collection).
Both of these collections are straightforward to use, although the spreadsheets collection provides many more options. For more about these collections and their use, see the reference documentation links above or the following developer guides:
This section explains some of the terms you’ll encounter when reading about the Sheets API.
Every API method requires a spreadsheet Id parameter which is used to identify which spreadsheet is to be accessed or altered. This ID is the value between the “/d/” and the “/edit” in the URL of your spreadsheet. For example, consider the following URL that references a Google Sheets spreadsheet:
The ID of this spreadsheet is 1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps. If you’re familiar with the Drive API, the spreadsheet_id corresponds to the ID of the File resource.
Individual sheets in a spreadsheet have titles (which must be unique) and IDs. The sheetId is used frequently in the Sheets API to specify which sheet is being read or updated. In the Sheets UI, you can find the sheetId of the open sheet in the spreadsheet URL, as the value of the gid parameter. The following shows the structure of the URL and where sheetId can be found:
You can also fetch the IDs of sheets using the API; see the Determine sheet ID and other properties sample.
In addition, Google sheets lets you collaborate with others so to organize, track, and analyse your data, whether you’re using the Web, Android or iOS.
The new Google Spreadsheets API adds the value of importing data from other sources without going through a considerable manual work by enabling richer connections between sheets and other tools such as :