r7_sheet_format
Format XLSX cells/ranges: fonts, fills, borders, alignment, number formats, merges, column width, row height, preserving values/formulas. Set print layout in same call.
Instructions
Apply formatting to a cell or range in an XLSX worksheet: font, fill, borders, alignment, number format, merge, column width and row height. Values, formulas and unrelated styles are preserved. A sheet's print layout (fit-to-width so a table does not spill onto another page, orientation, paper, margins, centring) can be written in the same call with pageSetup.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fill | No | Cell background. | |
| font | No | Font settings. | |
| merge | No | Merge the range (or unmerge when set with unmerge: true). | |
| range | No | Cell or range to format, e.g. "B2" or "A1:D10". Optional when pageSetup is given. | |
| border | No | Borders. Each edge accepts a style name or { style, color }. Use "all" to set every edge at once. Styles: thin, medium, thick, dashed, dotted, double, hair, mediumDashed, dashDot, mediumDashDot, dashDotDot, mediumDashDotDot, slantDashDot. | |
| unmerge | No | Remove the merge covering this range. | |
| filePath | Yes | Path to XLSX file. | |
| alignment | No | Text alignment. | |
| pageSetup | No | Print layout for this sheet, written in the same save as the formatting. Use { fitToWidth: 1, fitToHeight: 0 } to keep a table one page wide with as many pages tall as it needs; fitToPage="1" is written automatically, without which fitToWidth is ignored by every renderer. | |
| rowHeight | No | Height in points for every row in the range. | |
| sheetName | No | Sheet name (takes precedence over sheetIndex). | |
| outputPath | No | Optional target path. | |
| sheetIndex | No | 0-based sheet index. | |
| columnWidth | No | Set the width of the columns spanned by the range. | |
| numberFormat | No | Excel number format. Values are stored as numbers, never as preformatted text. |