Autofit Multiple Rows in an Excel Worksheet

This REST API automatically adjusts the height of rows in an Excel worksheet.

REST API

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

Authentication – Obtain a JWT token from the /connect/token endpoint and include it in the request header as Authorization: Bearer <token>.

The request parameters are:

Parameter Name Type Location Description Required
name string path The name of the Excel file. ✔︎
sheetName string path The name of the worksheet. ✔︎
autoFitterOptions object body Options that control how rows are autofitted (e.g., ignore hidden rows). See the brief field description below.
startRow integer query The first row to autofit (1-based index). ✔︎
endRow integer query The last row to autofit (inclusive). ✔︎
onlyAuto boolean query When true, the API adjusts only rows whose height is automatically calculated by Excel. When false, a full autofit is performed.
folder string query The folder that contains the document.
storageName string query The name of the storage service.

autoFitterOptions fields (all optional):

  • AutoFitMergedCells (boolean) – If true, merged cells are taken into account when calculating row height.
  • IgnoreHidden (boolean) – When true, hidden rows are ignored during the autofit process.
  • OnlyAuto (boolean) – Mirrors the query‑parameter onlyAuto; when set, it overrides the query value.

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 access Aspose.Cells web services easily. The following example shows how to call the Cloud API with cURL.

Cloud SDK Family

Using an SDK is the fastest way to develop. An SDK handles low‑level details so you can focus on your project. Please check out 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: