Modify Grid Structure
modify_grid_structureInsert or delete rows and columns across Excel sheets while automatically rewriting every formula, name, and reference to keep the workbook coherent.
Instructions
Insert or delete rows or columns at a position and REWRITE EVERY REFERENCE so the workbook stays coherent: formulas on every sheet (cross-sheet refs included), defined names, data validations, conditional-format ranges, table refs, and merged ranges all shift with the edit. action is insert_rows, delete_rows, insert_cols, or delete_cols; at is the 1-based row number or column letter where the edit starts (a cell like 'B7' or a location object also works, using its top-left); count edits that many at once.
Whole-column spans like =SUM(B:B) and whole-row spans like $1:$2 shift on their own axis; an edit on the other axis leaves them alone (Excel's behavior). A reference wholly inside a deleted band becomes #REF! and the new-#REF! count is reported, never hidden; an insert that would push value-bearing cells off the grid edge refuses. Returns per-kind rewrite counts. A hazardous workbook refuses unless allow_loss is true. Auto-backup: prev/anchor slots in .ks4xl-backups (backup=false skips rotation); atomic verified save, restored on failed verify; the prev slot is the undo for a delete. Refuses while open in Excel.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| at | Yes | Where the insert or delete starts: a 1-based row number (5), a column letter ('B'), an A1 cell ('B7', whose row or column is used), or a location object. | |
| path | Yes | ||
| count | No | ||
| sheet | No | ||
| action | Yes | ||
| backup | No | ||
| allow_loss | No | ||
| verify_com | No |