Method: spreadsheets.values.update
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
HTTP 请求
PUT https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}
网址采用 gRPC 转码语法。
路径参数
参数 |
spreadsheetId |
string
要更新的电子表格的 ID。
|
range |
string
要更新的值的 A1 表示法。
|
查询参数
参数 |
valueInputOption |
enum (ValueInputOption )
应如何解读输入数据。
|
includeValuesInResponse |
boolean
确定更新响应是否应包含已更新的单元格的值。默认情况下,响应不包含更新后的值。如果要写入的范围大于实际写入的范围,则响应将包含请求范围内的所有值(不包括尾随空白行和列)。
|
responseValueRenderOption |
enum (ValueRenderOption )
确定应如何呈现响应中的值。默认渲染选项为 FORMATTED_VALUE 。
|
responseDateTimeRenderOption |
enum (DateTimeRenderOption )
确定响应中的日期、时间和时长应如何呈现。如果 responseValueRenderOption 为 FORMATTED_VALUE ,系统会忽略此值。默认的 dateTime 呈现选项为 SERIAL_NUMBER 。
|
请求正文
请求正文包含一个 ValueRange
实例。
响应正文
如果成功,则响应正文包含一个 UpdateValuesResponse
实例。
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/spreadsheets
如需了解详情,请参阅授权指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-22。
[null,null,["最后更新时间 (UTC):2025-03-22。"],[],[],null,["# Method: spreadsheets.values.update\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nSets values in a range of a spreadsheet. The caller must specify the spreadsheet ID, range, and a [valueInputOption](/workspace/sheets/api/reference/rest/v4/ValueInputOption).\n\n### HTTP request\n\n`PUT https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-----------------|------------------------------------------------------------------------------------------------------------------------------|\n| `spreadsheetId` | `string` The ID of the spreadsheet to update. |\n| `range` | `string` The [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of the values to update. |\n\n### Query parameters\n\n| Parameters ||\n|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `valueInputOption` | `enum (`[ValueInputOption](/workspace/sheets/api/reference/rest/v4/ValueInputOption)`)` How the input data should be interpreted. |\n| `includeValuesInResponse` | `boolean` 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). |\n| `responseValueRenderOption` | `enum (`[ValueRenderOption](/workspace/sheets/api/reference/rest/v4/ValueRenderOption)`)` Determines how values in the response should be rendered. The default render option is [FORMATTED_VALUE](/workspace/sheets/api/reference/rest/v4/ValueRenderOption). |\n| `responseDateTimeRenderOption` | `enum (`[DateTimeRenderOption](/workspace/sheets/api/reference/rest/v4/DateTimeRenderOption)`)` Determines how dates, times, and durations in the response should be rendered. This is ignored if [responseValueRenderOption](/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update#body.QUERY_PARAMETERS.response_value_render_option) is [FORMATTED_VALUE](/workspace/sheets/api/reference/rest/v4/ValueRenderOption). The default dateTime render option is [SERIAL_NUMBER](/workspace/sheets/api/reference/rest/v4/DateTimeRenderOption). |\n\n### Request body\n\nThe request body contains an instance of [ValueRange](/workspace/sheets/api/reference/rest/v4/spreadsheets.values#ValueRange).\n\n### Response body\n\nIf successful, the response body contains an instance of [UpdateValuesResponse](/workspace/sheets/api/reference/rest/v4/UpdateValuesResponse).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive`\n- `https://www.googleapis.com/auth/drive.file`\n- `https://www.googleapis.com/auth/spreadsheets`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]