apply_edits
Apply a batch of spreadsheet edits atomically: validates every change before writing, saves once, and restores from backup if verification fails.
Instructions
Apply many addressed edits as ONE atomic batch. edits is a list of {op, location, ...}: set_value {value}, set_formula {formula}, clear {what: contents|formats|all}, write_range {data: 2D array}. location is any location object, including a stale-checked get_grid_view anchor.
Every location is resolved and every op validated BEFORE anything is written, so a single bad edit refuses the whole batch and the file stays byte-for-byte unchanged. The batch then takes ONE backup (prev/anchor slots in .ks4xl-backups), does ONE atomic save, and runs ONE verify-after-write, which restores from the backup if the produced file fails to read back as intended. Formula edits are normalized and flag recalculation; each write_range op honors the 200,000-cell ceiling. A hazardous workbook refuses unless allow_loss is true; refuses while the file is open in Excel. Returns the count of edits applied and cells touched.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| edits | Yes | ||
| backup | No | ||
| allow_loss | No | ||
| verify_com | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||