Google Sheets API . spreadsheets . values

Instance Methods

batchGet(spreadsheetId, valueRenderOption=None, majorDimension=None, ranges=None, dateTimeRenderOption=None, x__xgafv=None)

Returns one or more ranges of values from a spreadsheet.

batchUpdate(spreadsheetId, body, x__xgafv=None)

Sets values in a range of a spreadsheet.

get(spreadsheetId, range, valueRenderOption=None, majorDimension=None, dateTimeRenderOption=None, x__xgafv=None)

Returns a range of values from a spreadsheet.

update(spreadsheetId, range, body, valueInputOption=None, x__xgafv=None)

Sets values in a range of a spreadsheet.

Method Details

batchGet(spreadsheetId, valueRenderOption=None, majorDimension=None, ranges=None, dateTimeRenderOption=None, x__xgafv=None)
Returns one or more ranges of values from a spreadsheet.
The caller must specify the spreadsheet ID and one or more ranges.

Args:
  spreadsheetId: string, The id of the spreadsheet to retrieve data from. (required)
  valueRenderOption: string, How values should be represented in the output.
  majorDimension: string, The major dimension that results should use.

For example, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`,
then requesting `range=A1:B2,majorDimension=ROWS` will return
`[[1,2],[3,4]]`,
whereas requesting `range=A1:B2,majorDimension=COLUMNS` will return
`[[1,3],[2,4]]`.
  ranges: string, The A1 notation of the values to retrieve. (repeated)
  dateTimeRenderOption: string, How dates, times, and durations should be represented in the output.
This is ignored if ValueRenderOption option is
FORMATTED_VALUE.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # The response when retrieving more than one range of values in a spreadsheet.
    "spreadsheetId": "A String", # The id of the spreadsheet to retrieve data from.
    "valueRanges": [ # The requested values. The order of the ValueRanges is the same as the
        # order of the requested ranges.
      { # Data within a range of the spreadsheet.
        "range": "A String", # The range the values cover, in A1 notation.
            # For output, this range indicates the entire requested range,
            # even though the values will exclude trailing rows and columns.
        "values": [ # The data that was read or to be written.  This is an array of arrays,
            # the outer array representing all the data and each inner array
            # representing a major dimension. Each item in the inner array
            # corresponds with one cell.
            #
            # For output, empty trailing rows and columns will not be included.
            #
            # For input, supported value types are: bool, string, and double.
            # Null and empty values will be skipped.
            # To set a cell to an empty value, set the string value to an empty string.
          [
            "",
          ],
        ],
        "majorDimension": "A String", # The major dimension of the values.
            #
            # For output, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4,
            # then requesting range=A1:B2,majorDimension=ROWS will return [[1,2],[3,4]],
            # whereas requesting range=A1:B2,majorDimension=COLUMNS will return
            # [[1,3],[2,4]].
            #
            # For input, with range=A1:B2,majorDimension=ROWS then [[1,2],[3,4]]
            # will set A1=1,B1=2,A2=3,B2=4. With range=A1:B2,majorDimension=COLUMNS
            # then [[1,2],[3,4]] will set A1=1,B1=3,A2=2,B2=4.
            #
            # When writing, if this field is not set, it defaults to ROWS.
      },
    ],
  }
batchUpdate(spreadsheetId, body, x__xgafv=None)
Sets values in a range of a spreadsheet.
The caller must specify the spreadsheet ID,
a valueInputOption, and one or more
ValueRanges.

Args:
  spreadsheetId: string, The id of the spreadsheet to update. (required)
  body: object, The request body. (required)
    The object takes the form of:

{ # The request for updating more than one range of values in a spreadsheet.
    "data": [ # The new values to apply to the spreadsheet.
      { # Data within a range of the spreadsheet.
        "range": "A String", # The range the values cover, in A1 notation.
            # For output, this range indicates the entire requested range,
            # even though the values will exclude trailing rows and columns.
        "values": [ # The data that was read or to be written.  This is an array of arrays,
            # the outer array representing all the data and each inner array
            # representing a major dimension. Each item in the inner array
            # corresponds with one cell.
            #
            # For output, empty trailing rows and columns will not be included.
            #
            # For input, supported value types are: bool, string, and double.
            # Null and empty values will be skipped.
            # To set a cell to an empty value, set the string value to an empty string.
          [
            "",
          ],
        ],
        "majorDimension": "A String", # The major dimension of the values.
            #
            # For output, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4,
            # then requesting range=A1:B2,majorDimension=ROWS will return [[1,2],[3,4]],
            # whereas requesting range=A1:B2,majorDimension=COLUMNS will return
            # [[1,3],[2,4]].
            #
            # For input, with range=A1:B2,majorDimension=ROWS then [[1,2],[3,4]]
            # will set A1=1,B1=2,A2=3,B2=4. With range=A1:B2,majorDimension=COLUMNS
            # then [[1,2],[3,4]] will set A1=1,B1=3,A2=2,B2=4.
            #
            # When writing, if this field is not set, it defaults to ROWS.
      },
    ],
    "valueInputOption": "A String", # How the input data should be interpreted.
  }

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # The response when updating a range of values in a spreadsheet.
    "responses": [ # One UpdateValuesResponse per requested range, in the same order as
        # the requests appeared.
      { # The response when updating a range of values in a spreadsheet.
        "updatedRange": "A String", # The range (in A1 notation) that updates were applied to.
        "updatedColumns": 42, # The number of columns where at least one cell in the column was updated.
        "updatedCells": 42, # The number of cells updated.
        "updatedRows": 42, # The number of rows where at least one cell in the row was updated.
        "spreadsheetId": "A String", # The spreadsheet the updates were applied to.
      },
    ],
    "totalUpdatedCells": 42, # The total number of cells updated.
    "totalUpdatedColumns": 42, # The total number of columns where at least one cell in the column was
        # updated.
    "totalUpdatedRows": 42, # The total number of rows where at least one cell in the row was updated.
    "spreadsheetId": "A String", # The spreadsheet the updates were applied to.
    "totalUpdatedSheets": 42, # The total number of sheets where at least one cell in the sheet was
        # updated.
  }
get(spreadsheetId, range, valueRenderOption=None, majorDimension=None, dateTimeRenderOption=None, x__xgafv=None)
Returns a range of values from a spreadsheet.
The caller must specify the spreadsheet ID and a range.

Args:
  spreadsheetId: string, The id of the spreadsheet to retrieve data from. (required)
  range: string, The A1 notation of the values to retrieve. (required)
  valueRenderOption: string, How values should be represented in the output.
  majorDimension: string, The major dimension that results should use.

For example, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`,
then requesting `range=A1:B2,majorDimension=ROWS` will return
`[[1,2],[3,4]]`,
whereas requesting `range=A1:B2,majorDimension=COLUMNS` will return
`[[1,3],[2,4]]`.
  dateTimeRenderOption: string, How dates, times, and durations should be represented in the output.
This is ignored if the ValueRenderOption option is
FORMATTED_VALUE.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Data within a range of the spreadsheet.
    "range": "A String", # The range the values cover, in A1 notation.
        # For output, this range indicates the entire requested range,
        # even though the values will exclude trailing rows and columns.
    "values": [ # The data that was read or to be written.  This is an array of arrays,
        # the outer array representing all the data and each inner array
        # representing a major dimension. Each item in the inner array
        # corresponds with one cell.
        #
        # For output, empty trailing rows and columns will not be included.
        #
        # For input, supported value types are: bool, string, and double.
        # Null and empty values will be skipped.
        # To set a cell to an empty value, set the string value to an empty string.
      [
        "",
      ],
    ],
    "majorDimension": "A String", # The major dimension of the values.
        #
        # For output, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4,
        # then requesting range=A1:B2,majorDimension=ROWS will return [[1,2],[3,4]],
        # whereas requesting range=A1:B2,majorDimension=COLUMNS will return
        # [[1,3],[2,4]].
        #
        # For input, with range=A1:B2,majorDimension=ROWS then [[1,2],[3,4]]
        # will set A1=1,B1=2,A2=3,B2=4. With range=A1:B2,majorDimension=COLUMNS
        # then [[1,2],[3,4]] will set A1=1,B1=3,A2=2,B2=4.
        #
        # When writing, if this field is not set, it defaults to ROWS.
  }
update(spreadsheetId, range, body, valueInputOption=None, x__xgafv=None)
Sets values in a range of a spreadsheet.
The caller must specify the spreadsheet ID, range, and
a valueInputOption.

Args:
  spreadsheetId: string, The id of the spreadsheet to update. (required)
  range: string, The A1 notation of the values to update. (required)
  body: object, The request body. (required)
    The object takes the form of:

{ # Data within a range of the spreadsheet.
  "range": "A String", # The range the values cover, in A1 notation.
      # For output, this range indicates the entire requested range,
      # even though the values will exclude trailing rows and columns.
  "values": [ # The data that was read or to be written.  This is an array of arrays,
      # the outer array representing all the data and each inner array
      # representing a major dimension. Each item in the inner array
      # corresponds with one cell.
      # 
      # For output, empty trailing rows and columns will not be included.
      # 
      # For input, supported value types are: bool, string, and double.
      # Null and empty values will be skipped.
      # To set a cell to an empty value, set the string value to an empty string.
    [
      "",
    ],
  ],
  "majorDimension": "A String", # The major dimension of the values.
      # 
      # For output, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4,
      # then requesting range=A1:B2,majorDimension=ROWS will return [[1,2],[3,4]],
      # whereas requesting range=A1:B2,majorDimension=COLUMNS will return
      # [[1,3],[2,4]].
      # 
      # For input, with range=A1:B2,majorDimension=ROWS then [[1,2],[3,4]]
      # will set A1=1,B1=2,A2=3,B2=4. With range=A1:B2,majorDimension=COLUMNS
      # then [[1,2],[3,4]] will set A1=1,B1=3,A2=2,B2=4.
      # 
      # When writing, if this field is not set, it defaults to ROWS.
}

  valueInputOption: string, How the input data should be interpreted.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # The response when updating a range of values in a spreadsheet.
    "updatedRange": "A String", # The range (in A1 notation) that updates were applied to.
    "updatedColumns": 42, # The number of columns where at least one cell in the column was updated.
    "updatedCells": 42, # The number of cells updated.
    "updatedRows": 42, # The number of rows where at least one cell in the row was updated.
    "spreadsheetId": "A String", # The spreadsheet the updates were applied to.
  }