服务端 API/云文档/电子表格/工作表/更新工作表属性
# 更新工作表属性
该接口和 [操作工作表](https://open.larksuite.com/document/ukTMukTMukTM/uYTMzUjL2EzM14iNxMTN) 的请求地址相同，但参数不同，调用前请仔细阅读文档。

该接口用于根据 spreadsheetToken 更新工作表属性。

## 请求

基本 | &nbsp;
---|---
HTTP URL | https://open.larksuite.com/open-apis/sheets/v2/spreadsheets/:spreadsheetToken/sheets_batch_update
HTTP Method | POST
支持的应用类型 | Custom App、Store App
权限要求<br>**调用该 API 所需的权限。开启其中任意一项权限即可调用**<br>开启任一权限即可 | 查看、评论、编辑和管理云空间中所有文件(drive:drive)<br>查看、评论、编辑和管理电子表格(sheets:spreadsheet)

### 请求头

名称 | 类型 | 必填 | 描述
---|---|---|---
Authorization | string | 是 | `user_access_token`或 `tenant_access_token`<br>**值格式**："Bearer `access_token`"<br>**示例值**："Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[了解更多：获取与使用access_token](https://open.larksuite.com/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)
Content-Type | string | 是 | **固定值**："application/json; charset=utf-8"

### 查询参数

**注意事项**：user_id_type目前默认值为lark_id，2022年1月26日后将会调整默认值为open_id，且不再支持lark_id，请尽快适配！

参数 | 类型 | 必须 | 说明
---|---|---|---
user_id_type | string | 否 | 请求的用户id类型，可选open_id,union_id

### 路径参数

参数 | 类型 | 描述
---|---|---
spreadsheetToken | string | spreadsheet 的 token，获取方式见[在线表格开发指南](https://open.larksuite.com/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)

### 请求体 

**注意事项**：userIds字段已废弃，2022年1月26日后将不再支持userIds字段，请使用userIDs作为替代。userIDs为需要增加保护范围编辑权限的用户id，id类型由user_id_type字段决定。
|参数|类型|必须|说明|
|--|-----|--|-----------|
|requests| |是|请求操作，支持增、删、复制工作表，三个操作选一个| 
|&emsp;∟updateSheet | |否|更新工作表| 
|&emsp;&emsp;∟properties| |是| 工作表属性|
|&emsp;&emsp;&emsp;∟sheetId| string|是|read-only ,作为表格唯一识别参数| 
|&emsp;&emsp;&emsp;∟title|string |否|更改工作表标题| 
|&emsp;&emsp;&emsp;∟index|int |否|移动工作表的位置| 
|&emsp;&emsp;&emsp;∟hidden|bool |否|隐藏表格，默认 false| 
|&emsp;&emsp;&emsp;∟frozen<br>&emsp;&emsp;&emsp;&emsp;RowCount|int |否|冻结行数，小于等于工作表的最大行数，0表示取消冻结行|
|&emsp;&emsp;&emsp;∟frozen<br>&emsp;&emsp;&emsp;&emsp;ColCount|int |否|该 sheet 的冻结列数，小于等于工作表的最大列数，0表示取消冻结列|
|&emsp;&emsp;&emsp;∟protect|  |否|锁定表格| 
|&emsp;&emsp;&emsp;&emsp;∟lock| string |是|LOCK 、UNLOCK 上锁/解锁 | 
|&emsp;&emsp;&emsp;&emsp;∟lockInfo|string  |否|锁定信息| 
|&emsp;&emsp;&emsp;&emsp;∟userIds| array<int64> |否|除了本人与所有者外，添加其他的可编辑人员，已废弃 | 
|&emsp;&emsp;&emsp;&emsp;∟userIDs| array<string> |否|除了本人与所有者外，添加其他的可编辑人员,user_id_type不为空时使用该字段 | 
### 请求体示例    
```json
{
  "requests": [
    {
      "updateSheet": {
        "properties": {
          "sheetId": "string",
          "title": "string",
          "index": "int",
          "hidden": "bool",
          "frozenColCount": "int",
          "frozenRowCount": "int",
          "protect": {
            "lock": "LOCK",
            "lockInfo": "111",
            "userIDs": [
              "ou_xxxxxxxxxx"
            ]
          }
        }
      }
    }
  ]
}
```
  ### cURL 请求示例
```
curl --location --request POST 'https://open.larksuite.com/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": "",
          "index": 0,
          "frozenColCount": 10,
          "frozenRowCount": 20,
          "protect": {
            "lock": "LOCK",
            "lockInfo": "Lock Test"
            "userIDs": [
               "ou_xxxxxxxxxxxxx"
            ]
          }
        }
      }
    }
  ]
}'
```
## 响应  
### 响应体

**注意事项**：userIds字段已废弃，2022年1月26日后将不再支持userIds字段，请使用userIDs作为替代。userIDs为需要增加保护范围编辑权限的用户id，id类型由user_id_type字段决定。
|参数|类型|说明|
|--|-----|--|
|replies| |返回本次相关操作工作表的结果|
|&emsp;∟updateSheet| |更新工作表的属性|
|&emsp;&emsp;∟properties| |工作表属性|
|&emsp;&emsp;&emsp;∟sheetId|string| 表格的 sheetId|
|&emsp;&emsp;&emsp;∟title|string |更新的工作表标题|
|&emsp;&emsp;&emsp;∟index|int |移动工作表的位置|
|&emsp;&emsp;&emsp;∟hidden|bool |是否隐藏表格|
|&emsp;&emsp;&emsp;∟frozenRowCount|int |冻结行数|
|&emsp;&emsp;&emsp;∟frozenColCount|int |冻结列数|
|&emsp;&emsp;&emsp;∟protect| |保护工作表| 
|&emsp;&emsp;&emsp;&emsp;∟lock|string |LOCK 、UNLOCK 保护/取消保护 | 
|&emsp;&emsp;&emsp;&emsp;∟lockInfo|string |保护信息| 
|&emsp;&emsp;&emsp;&emsp;∟userIds|array<int64> |除了本人与所有者外，添加其他的可编辑人员，已废弃 | 
|&emsp;&emsp;&emsp;&emsp;∟userIDs|array<string> |除了本人与所有者外，添加其他的可编辑人员，user_id_type不为空时返回该字段 |
 ### 响应体示例    
```json
 {
  "code": 0,
  "msg": "Success",
  "data": {
    "replies": [
      {
        "updateSheet": {
          "properties": {
            "sheetId": "string",
            "title": "string",
            "index": 0,
            "hidden": true,
            "frozenColCount": 0,
            "frozenRowCount": 0,
            "protect": {
              "lock": "LOCK",
              "sheetName": "",
              "permId": "",
              "userIDs": [
                "ou_xxxxxxxxx"
              ]
            }
          }
        }
      }
    ]
  }
}
```
### 错误码

具体可参考：[服务端错误码说明](https://open.larksuite.com/document/ukTMukTMukTM/ugjM14COyUjL4ITN)
