API call description
Call this API to clear all content in a specified range, including formats and data. The result is the same as the operation shown in the figure below.Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/doc/workbooks/{workbookId}/sheets/{sheetId}/ranges/{rangeAddress}/clear |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Permissions required | permission-Document.Workbook.Write-DingTalk Spreadsheet write permission |
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential for calling this API. Obtain it as follows: - For an internal app, call the Get the access token of an internal app API. - For a third-party enterprise app, call the Get the access token of an enterprise authorized to a third-party app API. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
| workbookId | String | Yes | The spreadsheet file ID. The nodeId(dentryUuid) returned by the Knowledge Base API is the workbookId of the spreadsheet. Obtain it by calling the Get node and Create Knowledge Base document APIs. |
| sheetId | String | Yes | The ID or title of the worksheet. - For an internal app, call the Get all worksheets API to obtain the ID, or pass the title of the worksheet. - For a third-party enterprise app, we recommend passing the title of the worksheet. The steps to view the worksheet title are shown in the figure below. |
| rangeAddress | String | Yes | The cell range to clear, in the format top-left cell of the range:bottom-right cell of the range. For example, B2:C3 indicates the range shown in the figure below. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| operatorId | String | Yes | The unionId of the operator. Call the Query user details API to obtain it. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| a1Notation | String | The cell address. |
Response body example
Error codes
If an error occurs when calling this API, refer to the Global error codes document for solutions based on the error message.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | invalidRequest.inputArgs.invalid | %s | Invalid request parameter. See the error message for details. |
| 400 | invalidRequest.inputArgs.workbookIdIllegal | The workbookId is illegal. | The workbookId is invalid. |
| 400 | invalidRequest.resource.notWorkbook | %s | Unsupported document type. Check the workbookId. |
| 403 | forbidden.accessDenied | The operator has no permission. | The current user does not have permission to perform this action. |
| 403 | forbidden.acrossOrg | %s | Invalid request. Check whether the document to access belongs to the organization specified by the access token. |
| 403 | forbidden.operationIllegal | %s | Invalid request action. See the error message for details. |
| 403 | forbidden.document.sizeOverLimit | The document size is over limit and the server is unable to complete your request. Retry is unlikely to work unless the document size is decreased. | The spreadsheet content is too large. Try reducing the content. |
| 404 | invalidRequest.resource.notFound | %s | Request failed. The resource to access cannot be found. |
| 500 | serviceBusy | The server is busy and unable to complete your request. Please try again later. | The service is busy. Try again later. |
| 500 | internalError | The server encountered an internal error and was unable to complete your request. Please try again later. | Internal server error. Try again later. |