format_cells
Apply font, fill, alignment, borders, and number formats to a specified cell range in an Excel sheet. Control style attributes individually or with presets while preserving existing formatting.
Instructions
Apply font, fill, alignment, borders and number formats to a cell range.
Args:
file_path, sheet_name: Target workbook and sheet.
cell_range: Range to format.
bold, italic, font_size, font_color, bg_color: Font and fill controls.
number_format: Custom number format string.
horizontal_alignment, vertical_alignment: Alignment enums.
wrap_text, border_style, border_color, font_name, underline, strikethrough, text_rotation, indent, shrink_to_fit: Formatting options.
top_border_style, bottom_border_style, left_border_style, right_border_style: Per-side border overrides.
number_format_preset: Named preset from NUMBER_FORMAT_PRESETS.
preserve_existing: If True, do not overwrite unspecified style attributes.
Returns: str: Result message.
Notes: - Mutates formatting in workbook; recommend documenting idempotency when called multiple times with same args.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bold | No | ||
| indent | No | ||
| italic | No | ||
| bg_color | No | ||
| file_path | Yes | ||
| font_name | No | ||
| font_size | No | ||
| underline | No | ||
| wrap_text | No | ||
| cell_range | Yes | ||
| font_color | No | ||
| sheet_name | Yes | ||
| border_color | No | ||
| border_style | No | ||
| number_format | No | ||
| shrink_to_fit | No | ||
| strikethrough | No | ||
| text_rotation | No | ||
| top_border_style | No | ||
| left_border_style | No | ||
| preserve_existing | No | ||
| right_border_style | No | ||
| vertical_alignment | No | ||
| bottom_border_style | No | ||
| horizontal_alignment | No | ||
| number_format_preset | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |