Workbook Editor
Use the six workbook_* tools for semantic and visual workbook work. Treat every workbook as potentially hostile active content.
Required workflow
- Call
workbook_inspectbefore editing an unfamiliar workbook. Review validation warnings, external relationships, protected parts, and engine capabilities. - Call
workbook_readfor the exact sheet/range. Callworkbook_renderwhenever layout, fills, borders, dimensions, or visual comparison matter. - Build an ordered operation list and call
workbook_editwithdryRun: true. Save the returnedsourceSha256. - Commit to a new output path by default. Set
dryRun: falseand pass the exactexpectedSha256from the current inspection/dry run. - Call
workbook_validateon the result, using the source asbaselinePathfor.xlsmor active-content work. - Call
workbook_diffand render the affected range. Report the output and any recovery path.
Operation intent
- Use
setValuefor literal text, numbers, booleans, or null. Leading=,+,-, and@remain text when passed as strings. - Use
setFormulaonly for formulas. External-workbook, URL, DDE,WEBSERVICE,FILTERXML, and RTD constructs are rejected. - Use
setStylefor explicit font, fill, border, alignment, number-format, or cell-protection patches. - Use
copyRangefor same-sized range templates; set optionalsourceSheetfor cross-sheet copies. UsecopyFormatwhen only styles should be reproduced andfillRangeto translate ordinary relative A1 formulas from one source cell. - Shared, array, data-table, and spill formula regions are preservation-only. Value/content edits that intersect them fail closed; inspect formula inventory before restructuring formula-heavy sheets.
- Use
clear, dimensions, merge, and unmerge operations only after reading existing merges and layout.
Safety rules
- Never execute macros. Preservation does not imply that VBA was reviewed, trusted, or safe.
- Never request VBA source mutation or workbook macro execution through these tools; those capabilities are intentionally absent.
- Never refresh external links, Power Query, DDE, or data connections.
- Never silently convert
.xlsmand.xlsx; output extension must match source. - Never omit
expectedSha256on a commit or retry a conflict using an old hash. - Never overwrite in place unless the user explicitly asked. In-place writes require
overwrite: trueand return a recovery copy. - Do not suggest lossy fallback libraries when the engine rejects an unsupported operation.
- Keep ranges focused. Full structured results are stored in temporary artifacts when model-visible output is truncated.
Backend policy
The enabled backend is ooxml-safe, a bounded surgical implementation. It changes only operation-declared OOXML parts and verifies protected parts after saving; per-file package mutability checks can reject an otherwise supported operation. Native Excel may appear in /workbook-doctor, but mutation is disabled because the bounded bakeoff changed merged-cell styles during .xlsx no-op serialization and changed xl/vbaProject.bin during .xlsm no-op serialization. Aspose is an optional deferred tier.
Verification expectations
A successful edit is not complete until:
workbook_validatereportsok: true;workbook_diffshows only operation-declared OOXML changes;- protected-part changes are empty;
- the focused PNG preview is visually reasonable when formatting changed;
- any warnings, truncation, unsupported rich objects, or missing native Excel repair-prompt check are disclosed.