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):2024-09-05。
[null,null,["最后更新时间 (UTC):2024-09-05。"],[[["This method allows you to set values within a specified range of a Google Sheet using the provided spreadsheet ID, range, and value input option."],["You can control data interpretation, response inclusion of updated values, value rendering, and date/time rendering through query parameters."],["The request body requires a ValueRange object defining the values to be set, while a successful response returns an UpdateValuesResponse object."],["Authorization is necessary using one of the specified OAuth scopes: `https://www.googleapis.com/auth/drive`, `https://www.googleapis.com/auth/drive.file`, or `https://www.googleapis.com/auth/spreadsheets`."]]],["This outlines updating spreadsheet values using a `PUT` request to the Google Sheets API. Key actions include specifying the `spreadsheetId` and `range` in the URL's path parameters. The request requires a `valueInputOption` in the query parameters to define data interpretation. Optional query parameters allow controlling response content and formatting. The request body uses `ValueRange`, and a successful response includes `UpdateValuesResponse`. Authorization requires specific OAuth scopes: `drive`, `drive.file`, or `spreadsheets`.\n"]]