set_excel_column_widths
Set column widths for Excel sheets manually or auto-fit to content. Configurable max width and wrap overflow ensure long descriptions fit neatly.
Instructions
Set column widths manually and/or auto-fit them to content.
Auto-fit sizes each column to its longest content (full-width CJK
characters count double), capped at max_width. Cells longer than the
cap get wrap_text enabled so long descriptions wrap onto multiple
lines instead of stretching the column; Excel auto-expands their row
heights on open. Columns in widths are set exactly and skipped by
auto-fit.
@param file_path: Absolute path to the .xlsx/.xlsm file. @param sheet_name: Target sheet. None = first sheet. @param widths: Explicit widths per column letter, e.g. {"A": 12, "B": 35}. @param auto_fit: Auto-size all other columns in the used range. @param max_width: Width cap for auto-fit in character units (default 60). @param wrap_overflow: Wrap cells longer than max_width (default true). @return: Confirmation listing each column and the width applied.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| widths | No | ||
| auto_fit | No | ||
| file_path | Yes | ||
| max_width | No | ||
| sheet_name | No | ||
| wrap_overflow | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |