# 删除行列

该接口用于删除电子表格中的指定行或列。
## 使用限制

- 单次调用该接口，最多支持删除 5000 行或列。
- 一个工作表最少需有一行一列。你无法删除所有行或列。

## 请求

基本 | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/:spreadsheetToken/dimension_range
HTTP Method | DELETE
接口频率限制 | [100 次/秒](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
支持的应用类型 | Custom App、Store App
权限要求<br>**调用该 API 所需的权限。开启其中任意一项权限即可调用**<br>开启任一权限即可 | 查看、评论、编辑和管理云空间中所有文件(drive:drive)<br>查看、评论、编辑和管理电子表格(sheets:spreadsheet)

### 请求头

名称 | 类型 | 必填 | 描述
---|---|---|---
Authorization | string | 是 | 通过访问凭证（access_token）对调用者身份进行鉴权。可选值：<br>- `tenant_access_token`：        租户授权凭证。应用代表租户（即企业或团队）执行对应操作。示例值："Bearer t-7f1bcd13fc57d46bac21793aabcef"<br>- `user_access_token`：用户授权凭证。应用代表用户执行对应操作。示例值："Bearer u-7f1bcd13fc57d46bac21793aabcef"<br>了解更多，参考[获取访问凭证](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)。
Content-Type | string | 是 | **固定值**："application/json; charset=utf-8"

### 路径参数
|名称|类型|描述|
|--|--|----|
|spreadsheetToken|string| 电子表格的 token。可通过以下两种方式获取。了解更多，参考[电子表格概述](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)。<br>-  电子表格的 URL：https://sample.feishu.cn/sheets/==Iow7sNNEphp3WbtnbCscPqabcef== <br>- 调用[获取文件夹中的文件清单](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/list)|
### 请求体
|名称|类型|必须|描述&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;|
|--|-----|--|----|
|dimension|/|是|需要删除行列的范围信息。将删除 [startIndex,endIndex] 区间内的行或列|
|&emsp;∟sheetId|string|是|工作表的 ID。调用[获取工作表](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/sheets-v3/spreadsheet-sheet/query)获取 ID|
|&emsp;∟majorDimension|string|是|删除的维度。可选值：<br>- `ROWS`：行 <br>- `COLUMNS`：列|
|&emsp;∟startIndex|int|是|要删除的行或列的起始位置，从 1 开始计数。若 `startIndex` 为 3，则从第 3 行或列开始删除。包含第 3 行或列。|
|&emsp;∟endIndex|int|是|要删除的行或列结束的位置。从 1 开始计数。若 `endIndex` 为 7，则删除至第 7 行或列结束。包含第 7 行或列。<br>示例：当 `majorDimension` 为 `ROWS`、 `startIndex` 为 3、`endIndex` 为 7 时，则删除第 3、4、5、6、7 行的数据，共删除 5 行。|
### 请求体示例
```json
{
    "dimension":{
        "sheetId":"2jm6f6",
        "majorDimension":"ROWS",
        "startIndex":3,
        "endIndex":7
    }
}
```
###  cURL 请求示例
```bash
curl --location --request DELETE 'https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/shtcngNygNfuqhxTBf588jwgWbJ/dimension_range' \
--header 'Authorization: Bearer t-e346617a4acfc3a11d4ed24dca0d0c0fc8e0067e' \
--header 'Content-Type: application/json' \
--data-raw '{
    "dimension":{
        "sheetId":"2jm6f6",
        "majorDimension":"ROWS",
        "startIndex":3,
        "endIndex":7
    }
}'
```
## 响应
### 响应体
|名称|类型|描述|
|--|-----|--|
|delCount|int |一共删除的行数或列数|
|majorDimension|string |删除的维度。枚举值：<br>- `ROWS`：行 <br>- `COLUMNS`：列|
### 响应体示例
```json
{
    "code": 0,
    "data": {
        "delCount": 0,
        "majorDimension": "ROWS"
    },
    "msg": "success"
}

```
### 错误码

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