Sets values in a range of a spreadsheet. The caller must specify the spreadsheet ID, range, and a valueInputOption.
Arguments
Parameters | |
---|---|
range |
Required. The A1 notation of the values to update. |
spreadsheetId |
Required. The ID of the spreadsheet to update. |
includeValuesInResponse |
Determines if the update response should include the values of the cells that were updated. By default, responses do not include the updated values. If the range to write was larger than the range actually written, the response includes all values in the requested range (excluding trailing empty rows and columns). |
responseDateTimeRenderOption |
Determines how dates, times, and durations in the response should be rendered. This is ignored if response_value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER. |
Enum type. Can be one of the following: | |
SERIAL_NUMBER |
Instructs 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_STRING |
Instructs date, time, datetime, and duration fields to be output as strings in their given number format (which depends on the spreadsheet locale). |
responseValueRenderOption |
Determines how values in the response should be rendered. The default render option is FORMATTED_VALUE. |
Enum type. Can be one of the following: | |
FORMATTED_VALUE |
Values 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, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return "$1.23" . |
UNFORMATTED_VALUE |
Values will be calculated, but not formatted in the reply. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return the number 1.23 . |
FORMULA |
Values will not be calculated. The reply will include the formulas. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return "=A1" . |
valueInputOption |
How the input data should be interpreted. |
Enum type. Can be one of the following: | |
INPUT_VALUE_OPTION_UNSPECIFIED |
Default input value. This value must not be used. |
RAW |
The values the user has entered will not be parsed and will be stored as-is. |
USER_ENTERED |
The values will be parsed as if the user typed them into the UI. Numbers will stay as numbers, but strings may be converted to numbers, dates, etc. following the same rules that are applied when entering text into a cell via the Google Sheets UI. |
body |
Required. |
Raised exceptions
Exceptions | |
---|---|
ConnectionError |
In case of a network problem (such as DNS failure or refused connection). |
HttpError |
If the response status is >= 400 (excluding 429 and 503). |
TimeoutError |
If a long-running operation takes longer to finish than the specified timeout limit. |
TypeError |
If an operation or function receives an argument of the wrong type. |
ValueError |
If 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 of UpdateValuesResponse
.
Subworkflow snippet
Some fields might be optional or required. To identify required fields, refer to the API documentation.
YAML
- update: call: googleapis.sheets.v4.spreadsheets.values.update args: range: ... spreadsheetId: ... includeValuesInResponse: ... responseDateTimeRenderOption: ... responseValueRenderOption: ... valueInputOption: ... body: majorDimension: ... range: ... values: ... result: updateResult
JSON
[ { "update": { "call": "googleapis.sheets.v4.spreadsheets.values.update", "args": { "range": "...", "spreadsheetId": "...", "includeValuesInResponse": "...", "responseDateTimeRenderOption": "...", "responseValueRenderOption": "...", "valueInputOption": "...", "body": { "majorDimension": "...", "range": "...", "values": "..." } }, "result": "updateResult" } } ]