# Auto Fit Workbook (preview)

> Auto Fit Workbook activity that adjusts the width of the columns and the height of the rows in a range to fit their contents.

`UiPath.Excel.Activities.AutoFit`

## Description

Adjusts the width of the columns and the height of the rows in a range to fit their contents. This is the cross-platform equivalent of the [Autofit Range](https://docs.uipath.com/activities/other/latest/productivity/auto-fit-x) Windows activity.

:::note
This activity does not support `.xls` files.
:::

## Project compatibility

Windows | Cross-platform

## Properties

### Common

* **DisplayName** - The name displayed for the activity in the Designer panel.

### Input

* **File** - The full path of the resource workbook. To switch to a local path, select the plus icon, and then **Use Local File**. The current field changes to **File (local path)**, where you can provide the full path of the workbook.
* **SheetName** - The name of the sheet from the workbook.
* **Range** - The range to autofit. If you don't specify a range, the whole used range of the sheet is used.

### Options

* **Fit Columns** - Select this option to fit the column widths to their contents. By default, this option is selected.
* **Fit Rows** - Select this option to fit the row heights to their contents. By default, this option is selected.
* **Password** - The password of the workbook, if necessary.

### Use Workbook

* **Workbook** - The existing workbook to use instead of a file path.

## Notes

* Column width and row height are properties of the entire column or row. A **Range** narrower than the sheet only determines which cells are measured. The entire column or row is still resized.
* A whole-column or whole-row range, such as `A:A`, is limited to the used range of the sheet when measuring.
* **Range** must refer to the sheet in **SheetName**. A range that includes a sheet name, such as `Sheet2!A1:A10`, is not supported and causes an error.
