Write cells
xlide_write_cellsWrite a block of values or formulas into an Excel worksheet at a specified start cell and save the file. Overwrites are blocked unless allow_overwrite is true.
Instructions
Writes a rectangular block of values and formulas into a worksheet, starting at one cell, and saves the file. Each row of data is a row of the sheet. A string starting with '=' is written as a formula, as you would type it into Excel 365 with no _xlfn prefixes; anything else is a value. A cell given as {"rich_text": [{"text": "Total ", "bold": true}, {"text": "42"}]} is text in more than one font. A value written over a formula removes that formula, which is what typing into the cell does. On .xlsx, .xlsm and .xlam, only the touched worksheet rows are rewritten; their cached formula results remain stale until Excel opens the file or xlide_read_cells calculates them in memory. Writing .xlsb cells needs Windows with Excel, which recalculates and saves the workbook. Writing .xls cells is not offered. Cells that hold data are refused until allow_overwrite=true; ask the user first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Rows of cell values. Numbers, strings, booleans, null for empty, strings starting with '=' for formulas, and {"rich_text": [runs]} for text in several fonts, each run a text with any of bold, italic, strike, underline, size, font, color (RRGGBB) and script. | |
| sheet | Yes | Worksheet name, matched without case. | |
| timeout | No | Seconds allowed if Excel has to do the write. | |
| file_path | Yes | Absolute path to the Excel file. | |
| start_cell | Yes | Top-left cell of the block, such as B2. | |
| allow_overwrite | No | Allow replacing cells that already hold data or formulas. Ask the user first. Without it, the write is refused before saving. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||