xlsx
Installation
SKILL.md
Excel workbooks
Use openpyxl: uv run --no-project --with openpyxl script.py. Bundled scripts declare their own dependencies; resolve their paths relative to this skill. CSV/TSV inputs may be analyzed with DuckDB/Polars and exported to the requested workbook rather than duplicating a data-analysis skill.
Workflow
- Inspect sheets, formulas, cached values, merged cells, input conventions, charts and external workbook links before editing. Load formula strings with
data_only=False; use a separatedata_only=Trueload for inspecting cached values. Never save the cached-value load over the formula-bearing workbook. - Keep the original and use a new output. Preserve formulas/styles in existing files; follow the user's exact sheet names, headers, units and calculation rules. Read workbook features for charts, templates and macro limitations; read financial models for financial outputs.
- Write formulas, not precomputed constants, when inputs must remain editable. Verify representative formulas against independently calculated expectations.
openpyxldoes not calculate formulas. - For compatible XLSX files, run the recalculation helper. It invokes LibreOffice with an isolated profile, checks cached results for errors/missing values and checks formulas were not lost. It publishes a new output only on success. Read formula verification for engine differences and refusal cases.
- Reopen the final workbook to verify sheet names, key inputs, formulas and calculated results. Validate structure and render/inspect relevant print pages; separately check charts and sheets in Excel when print layout does not show them.
uv run --no-project <skill>/scripts/recalc.py draft.xlsx calculated.xlsx
uv run --no-project <skill>/scripts/office.py validate calculated.xlsx
uv run --no-project <skill>/scripts/office.py render calculated.xlsx workbook-preview