Autofit Rows on an Excel Workbook – Aspose.Cells Cloud API

Prerequisites
Before calling the API, obtain a valid Bearer JWT token from the Aspose authentication service and ensure the target workbook is stored in a supported storage location (default storage or a custom one you have configured).

This REST API enables you to autofit rows in an Excel workbook, automatically adjusting row height after data is inserted or modified.

REST API

POST https://api.aspose.cloud/v3.0/cells/{name}/autofitrows

The request parameters include:

Parameter Name Type Location Description
name string path Name of the workbook file.
autoFitterOptions AutoFitterOptions body Options that control the autofit behavior.
startRow integer query Index of the first row to autofit.
endRow integer query Index of the last row to autofit.
firstColumn integer query Index of the first column considered for autofit.
lastColumn integer query Index of the last column considered for autofit.
onlyAuto boolean query If true, only rows with the AutoFit flag are processed (default false).
folder string query Folder path where the workbook is stored.
storageName string query Name of the storage service.

AutoFitterOptions is an object that specifies how the autofit operation behaves (e.g., AutoFitMergedCells, IgnoreHidden).

Status Codes

Code Description
200 OK – Rows were successfully autofitted.
400 Bad Request – Invalid parameters or payload.
401 Unauthorized – Missing or invalid JWT token.
404 Not Found – Specified workbook or resource not found.
500 Internal Server Error – Unexpected server condition.

The OpenAPI Specification defines a publicly accessible programming interface and lets you carry out REST interactions directly from a web browser.

You can use the cURL command‑line tool to call Aspose.Cells web services. Replace <jwt token> with a valid Bearer JWT token obtained from the Aspose authentication service.

Notes

  • When AutoFitMergedCells is set to true, merged cells are considered as a single entity during the autofit operation.
  • Setting IgnoreHidden to true skips hidden rows and columns, preserving their current dimensions.

Cloud SDK Family

Using an SDK is the fastest way to develop. An SDK abstracts low‑level details so you can focus on your project. See the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.

The following code examples demonstrate how to call Aspose.Cells web services using various SDKs: