apply_edits
Apply multiple Excel edits atomically: validate all locations and operations before writing; if any edit is invalid, nothing changes, and a backup with verify-after-write restores the file on failure.
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 | Edits applied as ONE atomic batch: {op, location, ...}. | |
| backup | No | ||
| allow_loss | No | ||
| verify_com | No |