Method: googleapis.sheets.v4.spreadsheets.values.batchGet

Returns one or more ranges of values from a spreadsheet. The caller mustspecify the spreadsheet ID and one or more ranges.

Arguments

Parameters
spreadsheetId

string

Required. The ID of the spreadsheet to retrieve data from.

dateTimeRenderOption

enum

How dates, times, and durations should be represented in the output. This is ignored if value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.

Enum type. Can be one of the following:
SERIAL_NUMBERInstructs date, time, datetime, and duration fields to be output as doubles in "serial number" format, as popularized by Lotus 1-2-3. The whole number portion of the value (left of the decimal) counts the days since December 30th 1899. The fractional portion (right of the decimal) counts the time as a fraction of the day. For example, January 1st 1900 at noon would be 2.5, 2 because it's 2 days after December 30th 1899, and .5 because noon is half a day. February 1st 1900 at 3pm would be 33.625. This correctly treats the year 1900 as not a leap year.
FORMATTED_STRINGInstructs date, time, datetime, and duration fields to be output as strings in their given number format (which depends on the spreadsheet locale).
majorDimension

enum

The major dimension that results should use. For example, if the spreadsheet data is:A1=1,B1=2,A2=3,B2=4, then requestingranges=["A1:B2"],majorDimension=ROWS returns[[1,2],[3,4]], whereas requestingranges=["A1:B2"],majorDimension=COLUMNS returns[[1,3],[2,4]].

Enum type. Can be one of the following:
DIMENSION_UNSPECIFIEDThe default value, do not use.
ROWSOperates on the rows of a sheet.
COLUMNSOperates on the columns of a sheet.
ranges

string

TheA1 notation or R1C1 notation of the range to retrieve values from.

valueRenderOption

enum

How values should be represented in the output. The default render option is ValueRenderOption.FORMATTED_VALUE.

Enum type. Can be one of the following:
FORMATTED_VALUEValues will be calculated & formatted in the reply according to the cell's formatting. Formatting is based on the spreadsheet's locale, not the requesting user's locale. For example, ifA1 is1.23 andA2 is=A1 and formatted as currency, thenA2 would return"$1.23".
UNFORMATTED_VALUEValues will be calculated, but not formatted in the reply. For example, ifA1 is1.23 andA2 is=A1 and formatted as currency, thenA2 would return the number1.23.
FORMULAValues will not be calculated. The reply will include the formulas. For example, ifA1 is1.23 andA2 is=A1 and formatted as currency, then A2 would return"=A1".

Raised exceptions

Exceptions
ConnectionErrorIn case of a network problem (such as DNS failure or refused connection).
HttpErrorIf the response status is >= 400 (excluding 429 and 503).
TimeoutErrorIf a long-running operation takes longer to finish than the specified timeout limit.
TypeErrorIf an operation or function receives an argument of the wrong type.
ValueErrorIf an operation or function receives an argument of the right type but an inappropriate value. For example, a negative timeout.

Response

If successful, the response contains an instance ofBatchGetValuesResponse.

Subworkflow snippet

Some fields might be optional or required.To identify required fields, refer to theAPI documentation.

YAML

-batchGet:call:googleapis.sheets.v4.spreadsheets.values.batchGetargs:spreadsheetId:...dateTimeRenderOption:...majorDimension:...ranges:...valueRenderOption:...result:batchGetResult

JSON

[{"batchGet":{"call":"googleapis.sheets.v4.spreadsheets.values.batchGet","args":{"spreadsheetId":"...","dateTimeRenderOption":"...","majorDimension":"...","ranges":"...","valueRenderOption":"..."},"result":"batchGetResult"}}]

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.