Method: spreadsheets.values.get
从电子表格中返回一系列值。调用者必须指定电子表格 ID 和范围。
HTTP 请求
GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}
网址采用 gRPC 转码语法。
路径参数
参数 |
spreadsheetId |
string
要从中检索数据的电子表格的 ID。
|
range |
string
要从中检索值的范围的 A1 表示法或 R1C1 表示法。
|
查询参数
参数 |
majorDimension |
enum (Dimension )
结果应使用的主要维度。 例如,如果 Sheet1 中的电子表格数据为 A1=1,B1=2,A2=3,B2=4 ,则请求 range=Sheet1!A1:B2?majorDimension=ROWS 会返回 [[1,2],[3,4]] ,而请求 range=Sheet1!A1:B2?majorDimension=COLUMNS 会返回 [[1,3],[2,4]] 。
|
valueRenderOption |
enum (ValueRenderOption )
值在输出中的表示方式。默认呈现选项为 FORMATTED_VALUE 。
|
dateTimeRenderOption |
enum (DateTimeRenderOption )
日期、时间和时长在输出中的表示方式。如果 valueRenderOption 为 FORMATTED_VALUE ,则忽略此属性。默认的 dateTime 呈现选项是 SERIAL_NUMBER 。
|
响应正文
如果成功,则响应正文包含一个 ValueRange
实例。
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/spreadsheets.readonly
有关详情,请参阅授权指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-09-05。
[null,null,["最后更新时间 (UTC):2024-09-05。"],[[["This Google Sheets API endpoint retrieves a range of values from a specified spreadsheet and range using an HTTP GET request."],["Users need to provide the `spreadsheetId` and `range` as path parameters in the request URL."],["Optional query parameters allow customization of the output, including `majorDimension`, `valueRenderOption`, and `dateTimeRenderOption`."],["The response body, upon successful execution, will contain a `ValueRange` object with the requested data."],["Authorization is required using one of the specified OAuth scopes related to Google Drive or Google Sheets access."]]],["This describes retrieving data from a spreadsheet using a `GET` HTTP request. The request URL includes the `spreadsheetId` and `range` as path parameters. Optional query parameters, like `majorDimension`, `valueRenderOption`, and `dateTimeRenderOption`, allow customization of the returned data. The request body must be empty. The response contains the spreadsheet data in `ValueRange` format if the request is successful. Authentication requires specific OAuth scopes for access.\n"]]