Skip to content
Software capabilities
Google Sheets

Read values from a Google Sheets range

Use the Sheets API to retrieve a cell range from an external application. In Apps Script, getValues reads the same range as a two-dimensional JavaScript array.

Documentation reviewed · 2 methods with sources

Ways to do it

  1. API: GET /v4/spreadsheets/{spreadsheetId}/values/{range}
  2. SDK: Apps Script Range.getValues()
API

GET /v4/spreadsheets/{spreadsheetId}/values/{range}

Return the range as rows or columns. Set valueRenderOption to control whether you receive formatted values, raw calculated values, or formulas.

Read source: Google Sheets values.get
Requirements
A spreadsheet ID, an A1 or R1C1 range, and authorized file access. spreadsheets.readonly is one supported OAuth scope.
Limitations
Formatted values are the default. dateTimeRenderOption has no effect when that default is used.

Example text

GET /v4/spreadsheets/SPREADSHEET_ID/values/Sheet1!A1:B5?valueRenderOption=UNFORMATTED_VALUE
SDK

Apps Script Range.getValues()

Read a range in row order inside Apps Script. Empty cells appear as empty strings.

Read source: Apps Script Range.getValues
Requirements
An Apps Script execution with access to the spreadsheet and a Range object.
Limitations
When returning results from an Apps Script web app, convert Date values to supported primitives before passing the array to the browser.