Treat an AI-proposed spreadsheet edit as a patch against a known workbook version. Record each proposed cell address, old value or formula, new value or formula, reason, and expected result. Compare the patch with an allowlist of editable sheets and ranges before applying it. The editing program, not the prompt, enforces that boundary. Preserve protected sheets, data validation, named ranges, styles, hidden rows, and existing formulas unless the task explicitly authorizes their change. A dry run should report changed cells and any workbook-level changes. If the input version no longer matches the patch base, stop and inspect the conflict instead of applying a stale suggestion.
Workbook edits: review a cell diff before applying changes
Operational case
A depot assistant proposes 47 formulas in F2:F48. The diff also shows one change to E19, the threshold for SKU RM-63, and a missing validation rule on column B. Neither is in scope. The reviewer rejects the patch rather than accepting its correct-looking F values. A second patch changes only F2:F48, preserves Stock headers and Archive unchanged, and records the old and new formula for every modified cell. It is applied to a copy of version 7. The output workbook hash and change ledger are saved together for the final recalculation check.
Allowed: Stock!F2:F48 formula cells.
Denied: Stock!E19 threshold; Archive!*; validation/style changes.
Patch item: Stock!F2 old =B2-D2 new =B2+C2-D2.
Precondition: source workbook is Inventory October v7.
Apply to copy; compare formula and workbook-structure diffs.Performance and operating cost
A cell diff over M stored cells is O(M) time if the editor compares whole sheets; a narrower changed-range list is cheaper but can miss collateral workbook changes. Keep a structural check for the properties the editing library can modify, and compare the untouched sheets or hashes where appropriate. A full byte-for-byte workbook comparison is usually noisy because metadata can change on save, so review meaningful cell and workbook features. The model's patch plan is compact; its safety comes from preconditions, range checks, dry-run inspection, and rollback to the original file.
Common Mistakes
- Do not let the assistant enforce its own edit permissions with prompt text alone.
- Do not accept a correct output column if unrelated cells or validation changed.
- Do not apply a patch made for an older workbook revision.
Connected lessons
- Prompt engineering applications
- Prompt Engineering
- Formula prompts: test references, types, and fill behavior
- Prompt release artifacts: version the whole decision path
- Tool effects: reconcile receipts before retrying
- Workbook prompts: name sheets, ranges, types, and provenance
- Spreadsheet exports: keep untrusted labels as text
- Spreadsheet release checks: recalculate, reconcile, then inspect
- Project: review a depot replenishment workbook
- Spreadsheet prompt and workbook release decisions
