# Query a sheet

This interface is used to query worksheet information by worksheet ID, including the title, index, and whether the sheet is hidden.

## Prerequisite

Before calling this API, ensure that the current identity (either `tenant_access_token` or `user_access_token`) has been granted permissions to read or edit spreadsheets. Otherwise, the API will return HTTP 403 or 400 status codes. For more information, refer to [How to enable document permissions for applications or users](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN#16c6475a).

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/sheets/v3/spreadsheets/:spreadsheet_token/sheets/:sheet_id
HTTP Method | GET
Rate Limit | [1000 per minute & 50 per second](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App、Store App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.**<br>Enable any scope from the list | View, comment, edit, and manage all files in My Space(drive:drive)<br>View, comment, and download all files in My Space(drive:drive:readonly)<br>View, comment, edit, and manage Sheets(sheets:spreadsheet)<br>View spreadsheet(sheets:spreadsheet:read)<br>View, comment, and export Sheets(sheets:spreadsheet:readonly)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>or<br>`user_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)

### Path parameters

Parameter | Type | Description
---|---|---
spreadsheet_token | string | Spreadsheet token. Ways to get: <br>- Through the URL of the sheet: https://sample.feishu.cn/sheets/==shtcnmBAyGehy8abcef==<br>- Through the [List items in folder] API (https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/list)<br>**Example value**: "Iow7sNNEphp3WbtnbCscPqabcef"
sheet_id | string | The ID of the worksheet<br>**Example value**: "giDk9k"

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
sheet | sheet | sheet
sheet_id | string | Worksheet id
title | string | Worksheet title
index | int | Worksheet index. Counts from 0
hidden | boolean | Is the worksheet hidden
grid_properties | grid_properties | Cell properties, returned only when `resource_type=sheet`
frozen_row_count | int | Number of rows frozen
frozen_column_count | int | Number of columns frozen
row_count | int | Number of rows in the worksheet
column_count | int | Number of columns in the worksheet
resource_type | string | Worksheet type
merges | merge_range\[\] | Merge cells
start_row_index | int | Start line. Counts from 0
end_row_index | int | End line. Counts from 0
start_column_index | int | Start column. Counts from 0
end_column_index | int | End column. Counts from 0

### Response body example
```json
{
    "code": 0,
    "msg": "",
    "data": {
        "sheet": {
            "sheet_id": "sxj5ws",
            "title": "sheet1",
            "index": 0,
            "hidden": false,
            "grid_properties": {
                "frozen_row_count": 0,
                "frozen_column_count": 0,
                "row_count": 200,
                "column_count": 20
            },
            "resource_type": "sheet",
            "merges": [
                {
                    "start_row_index": 0,
                    "end_row_index": 0,
                    "start_column_index": 0,
                    "end_column_index": 0
                }
            ]
        }
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 1310251 | Invalid Parameters | Reference error message in response body
400 | 1310213 | Permission Fail | Confirm whether the current access identity has permission to read or edit spreadsheets. Please refer to the following methods to resolve this:<br>- If you are using a `tenant_access_token`, it means the current application does not have permission to read or edit spreadsheets. You need to add document permissions for the application through the cloud document webpage by navigating to the top right corner **"..."** -> **"... More"** -> **"Add applications"**.<br>**Note**: Before adding a document application, you need to ensure that the target application has at least one cloud document [API permission](https://open.feishu.cn/document/ukTMukTMukTM/uYTM5UjL2ETO14iNxkTN/scope-list) enabled. Otherwise, you will not be able to search for the target application in the document application window.<br>![](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/bb60f97ebb402475f2af1d3131d4914f_sLOzoqYRXX.png?height=1992&maxWidth=550&width=3278)<br>- If you are using a `user_access_token`, it means the current user does not have permission to read or edit spreadsheets. You need to add document permissions for the current user through the **Share** entry in the top right corner of the cloud document webpage.<br>![image.png](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/caceea2ac91c170555194d7a8dc2a317_GfTRc9xLAt.png&maxWidth=550)<br>For more details on the specific steps or other methods to add permissions, refer to [Cloud Document FAQ 3](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN#16c6475a).
400 | 1310249 | Spreadsheet Deleted | Restore the form and try again
400 | 1310214 | SpreadSheet Not Found | Check the spreadsheet token.
500 | 1315201 | Server Error | Internal service error. For more information, [contact support](https://applink.feishu.cn/client/helpdesk/open?id=6626260912531570952)
500 | 1315203 | Server Error | Internal service error. For more information, [contact support](https://applink.feishu.cn/client/helpdesk/open?id=6626260912531570952).
500 | 1315210 | Server Error | Internal service errors, please consult customer service for details

