API call description
- Automatically adjusts the row height for each row within the specified range based on the provided
fontWidth(font size), ensuring that content is fully displayed. - Use
row(starting row cursor) androwCount(number of rows) to specify the row range to auto-fit. - Row cursors start from 0. That is, the cursor of the first row is 0.
Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/doc/workbooks/{workbookId}/sheets/{sheetId}/autofitRows |
| HTTP Method | POST |
| Supported app type | appType-Internal app |
| Required permission | permission-Document.Workbook.Write-DingTalk Spreadsheet write permission |
Request header
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential used to call this API. You can obtain it by calling the Get the access token of an internal app API. |
Path parameter
| Name | Type | Required | Description |
|---|---|---|---|
| workbookId | String | Yes | The ID of the spreadsheet file. The nodeId (dentryUuid) is the workbookId of the spreadsheet. You can obtain it by calling the Get node or Create knowledge base document API. |
| sheetId | String | Yes | The ID or title of the worksheet. You can obtain it by calling the Get all worksheets API, or enter the title of the worksheet. |
Query parameter
| Name | Type | Required | Description |
|---|---|---|---|
| operatorId | String | Yes | The unionId of the operator. You can obtain it by calling the Query user details API. |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| row | Long | Yes | The row number, starting from 0. |
| rowCount | Long | Yes | The number of rows. |
| fontWidth | Long | Yes | The font size. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| id | String | The ID of the current worksheet. |
Response body example
Error codes
If an error occurs when calling this API, refer to the Global error codes document to find a solution based on the error message.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | invalidRequest.inputArgs.workbookIdIllegal | The workbookId is illegal. | The workbookId is invalid. |
| 400 | invalidRequest.inputArgs.operatorIdIllegal | The operatorId is illegal. | The operatorId is invalid. |
| 400 | invalidRequest.inputArgs.invalid | %s | The request parameter is invalid. Check the error message for details. |
| 400 | invalidRequest.resource.notWorkbook | %s | Unsupported document type. Check the workbookId. |
| 403 | forbidden.operationIllegal | %s | The requested action is invalid. Check the error message for details. |
| 403 | forbidden.accessDenied | The operator has no permission. | The current user does not have permission to perform this action. |
| 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. |
| 403 | forbidden.acrossOrg | %s | The request is invalid. Verify that the target document belongs to the organization specified by the access token. |
| 404 | invalidRequest.resource.notFound | %s | The request failed. The requested resource cannot be found. |
| 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. |
| 503 | serviceBusy | The server is busy and unable to complete your request. Please try again later. | The server is busy. Try again later. |