#  Update sheet properties

Update worksheets in spreadsheets. Supports updating worksheet titles, positions, and properties such as hidden, frozen, protected, etc.
This API uses the same request URL as [Operate sheets](https://open.feishu.cn/document/ukTMukTMukTM/uYTMzUjL2EzM14iNxMTN), but has different parameters. Read this document carefully before calling.
## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/:spreadsheet_token/sheets_batch_update
HTTP Method | POST
Supported app types | Custom App、Store App
Required scopes<br>**The scopes required to call this API. You can call the API with any of the scopes.**<br>Enable any scope from the list | View, comment, edit, and manage all files in My Space(drive:drive)<br>View, comment, edit, and manage Sheets(sheets:spreadsheet)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | Authenticate the caller's identity through the access token. Optional values:<br>- `tenant_access_token`: Tenant authorization credential. The application acts on behalf of the tenant (i.e., a company or team) to perform corresponding operations. Example value: "Bearer t-7f1bcd13fc57d46bac21793aabcef"<br>- `user_access_token`: User authorization credential. The application acts on behalf of the user to perform corresponding operations. Example value: "Bearer u-7f1bcd13fc57d46bac21793aabcef"<br>For more information, refer to [Obtaining Access Tokens](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM).
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
user_id_type | string | No | User ID type. The default is `lark_id`. It is recommended to choose `open_id` or `union_id`. For more information, refer to [User Identity Overview](https://open.feishu.cn/document/home/user-identity-introduction/introduction). Optional values:<br>- `open_id`: Identifies a user within a specific application. The same user has different Open IDs in different applications. Learn more: [How to Obtain Open ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-openid)<br>- `union_id`: Identifies a user under a specific application developer. The same user has the same Union ID in applications under the same developer and different Union IDs in applications under different developers. With Union ID, developers can link the identity of the same user across multiple applications. Learn more: [How to Obtain Union ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-union-id)

### 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](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/list) API .

### Request body 

Name | Type | Required | Description
---|---|---|---
requests | / | Yes | Request to update spreadsheet properties
updateSheet | / | No | Update spreadsheet
properties | <md-text type="field-type">/</md-dt-text> | Yes | Spreadsheet properties
sheetId | string | Yes | ID of the spreadsheet to be updated. Call [Get Spreadsheet](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/sheets-v3/spreadsheet-sheet/query) to get the ID
title | string | No | Title of the spreadsheet. The title needs to comply with the following rules:<br>- Not more than 100 characters in length<br>- Do not include these special characters: `/ \ ? * [ ] :`
index | int | No | Index of the spreadsheet. Count from 0.
hidden | <md-text type="field-type">bool | No | Whether to hide the sheet. Default value is false
frozenRowCount | <md-text type="field-type">int | No | Row index to freeze up to. If set to 3, it means freezing from the first row up to the third row. Must be less than or equal to the maximum number of rows in the sheet, 0 means no rows are frozen
frozenColCount | <md-text type="field-type">int | No | Column index to freeze up to. If set to 3, it means freezing from the first column up to the third column. Must be less than or equal to the maximum number of columns in the sheet, 0 means no columns are frozen
protect | <md-text type="field-type">/ | No | Whether to protect the spreadsheet
lock | <md-text type="field-type">string | Yes | Whether to protect the spreadsheet. Optional values:<br>- LOCK: Protect<br>- UNLOCK: Unprotect
<md-text type="field-name">lockInfo | <md-text type="field-type">string | No | Remarks information for protecting the spreadsheet
<md-text type="field-name">userIDs | <md-text type="field-type">array<string> | No | Add other users' IDs to give them edit permissions in the protected range, in addition to the owner and the user themselves. This field takes effect when the `user_id_type` query parameter is not empty.

### Request body example    

```json
{
  "requests": [
    {
      "updateSheet": {
        "properties": {
          "sheetId": "1SW8ik",
          "title": "Sales sheet",
          "index": 3,
          "hidden": true,
          "frozenColCount": 8,
          "frozenRowCount": 2,
          "protect": {
            "lock": "LOCK",
            "lockInfo": "privacy info",
            "userIDs": [
              "ou_48d0958ee4b2ab3eaf0b5f6c968abcef"
            ]
          }
        }
      }
    }
  ]
}
```
### cURL Request example

```bash
curl --location --request POST 'https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/shtcngNygNfuqhxTBf588jwgWbJ/sheets_batch_update?user_id_type=open_id' \
--header 'Authorization: Bearer t-e346617a4acfc3a11d4ed24dca0d0c0fc8e0067e' \
--header 'Content-Type: application/json' \
--data-raw '{
  "requests": [
    {
      "updateSheet": {
        "properties": {
          "sheetId": "zajIJ",
          "title": "Sales sheet",
          "index": 3,
          "hidden": true,
          "frozenColCount": 8,
          "frozenRowCount": 2,
          "protect": {
            "lock": "LOCK",
            "lockInfo": "privacy info"
            "userIDs": [
               "ou_48d0958ee4b2ab3eaf0b5f6c968abcef"
            ]
          }
        }
      }
    }
  ]
}'
```
## Response

### Response body

Name | Type | Description
---|---|---
replies | / | The result of this operation on the worksheet
updateSheet | <md-text type="field-type" >/ | The result of updating the worksheet
properties | <md-text type="field-type" >/ | Worksheet properties
sheetId | string | The ID of the updated worksheet
title | <md-text type="field-type" >string | The title of the updated worksheet
index | <md-text type="field-type" >int | The position of the moved worksheet
hidden | <md-text type="field-type" >bool | Whether to hide the sheet
frozen RowCount | <md-text type="field-type" >int | Row index to freeze up to
frozen ColCount | <md-text type="field-type" >int | Column index to freeze up to
protect | <md-text type="field-type" >/ | Worksheet protection properties
lock | <md-text type="field-type" >string | Whether to protect the worksheet. Optional values:<br>- LOCK: Protect<br>- UNLOCK: Unprotect
lockInfo | <md-text type="field-type" >string | Remarks on worksheet protection
<md-text type="field-name" >userIDs | <md-text type="field-type" >array<string> | IDs of other users with permission to edit the protected range, except for the owner and the user. The type of ID is determined by the query parameter `user_id_type`.

### Response body example    
```json
 {
  "code": 0,
  "msg": "Success",
  "data": {
    "replies": [
      {
        "updateSheet": {
          "properties": {
            "sheetId": "1SW8ik",
            "title": "Sales sheet",
            "index": 3,
            "hidden": true,
            "frozenColCount": 2,
            "frozenRowCount": 8,
            "protect": {
              "lock": "LOCK",
              "lockInfo": "privacy info",
              "userIDs": [
                "ou_48d0958ee4b2ab3eaf0b5f6c968abcef"
              ]
            }
          }
        }
      }
    ]
  }
}
```
### Error code

For details, refer to [Server-side error codes](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN).

