Skip to content
Data

XLSX

Create and edit spreadsheets while preserving formulas, workbook conventions, and recalculated results.

Install with Skills CLI
npx skills add anthropics/skills --skill xlsx

What it does

A workbook can look correct while containing stale formula results or broken references. The XLSX skill directs an agent to preserve spreadsheet structure and verify both formulas and selected outputs.

What changes after install

  • Uses spreadsheet-specific tools for formulas, formatting, and tabular data.
  • Distinguishes stored formulas from cached calculated values.
  • Adds recalculation, formula-error inspection, and checks against the task's assumptions.

Install

Run this command with Node.js 22.20 or later and select your agent in the Skills CLI.

Install with Skills CLI
npx skills add anthropics/skills --skill xlsx

Before using XLSX

  • Use Python with openpyxl for workbook editing; pandas and markitdown support the other documented workflows.
  • The bundled recalculation helper requires LibreOffice. Check that soffice is available before relying on recalculated formula values.

Read the reviewed setup instructions for the selected workflow.

When to use it

  • Updating a workbook while keeping existing formulas and formatting conventions.
  • Turning tabular data into an editable spreadsheet with derived values.

When not to use it

  • Treating the absence of formula errors as proof that business assumptions are correct.
  • Recognizing text in image-only scans before the rows have been extracted.
  • Producing an editable Word report when the spreadsheet only supplies the figures.

A worked example

Give the agent an order template and this request: “On the Orders sheet, enter 8 mugs at $12.50 each and a return of 2 mugs at the same price. Use the first two empty input rows. Keep the formulas and currency format. Save the result as october-orders.xlsx.”

First inspect the headings and the first populated row. Suppose columns A through D are Item, Quantity, Unit price and Line total. Confirm that A through C are input cells and that D already contains formulas in the two target rows. Use openpyxl to load the template with formulas intact. Enter quantities 8 and -2, and enter 12.50 in both price cells.

Save the copy. From the skill directory, run python scripts/recalc.py with the output workbook’s path. Open the result and check column D, Line total. The sale should read $100.00 and the return should represent negative $25.00. Together they should add $75.00 to the order total.

Troubleshooting

  • Missing dependency. If import openpyxl raises ModuleNotFoundError, install openpyxl in the Python environment running the edit, then retry the import.
  • Skill missing. In Claude Code, check that the document-skills bundle from anthropics/skills is enabled. Ask for the XLSX skill by name and include the workbook path.
  • Writing to a merged cell fails. If openpyxl reports that a MergedCell value is read-only, inspect the merged range containing that address. For a heading spanning B2 through D2, write the heading in B2, the top-left cell. If you meant to enter a quantity in C2, check the row mapping first: the quantity belongs in a data row below the heading. Writing it into B2 would overwrite the heading even though the assignment succeeds.

How it chooses an approach

For a quick text preview, markitdown exposes sheet headings and cell contents. It omits cell coordinates. Use openpyxl when the edit depends on a specific address, formula or format.

For a rectangular table with headers, use pandas to read records in bulk. Before combining two exports, match the header names and check their units. A column called Price might hold the price per mug in one export and the extended line amount in the other. Multiplying the latter by Quantity a second time produces a plausible but incorrect total.

When to use another skill

  • For a customer letter explaining the refund, pass the verified figures to DOCX.
  • If the order rows are still inside a supplier’s PDF, use PDF to extract them. Bring the item identifiers, quantities and prices back to the workbook after checking the first and last row on each page.
  • For a printable order form that staff will complete in Word, build the form with DOCX.

What to check after it runs

  • Read the recalculation report. Inspect total_errors and any formulas under not_computed, even when the script finishes successfully.
  • Reopen the file normally to inspect formulas, then separately with data_only=True to inspect cached amounts. Close the second copy without saving. Check that the order total includes the return exactly once.
  • Inspect the formula in the return row itself. It should multiply that row’s negative quantity by its unit price. A reference to the sale row can pass recalculation because both prices happen to be $12.50. On a spare copy, change only the return price and verify that the sale amount stays fixed.

FAQ

Why can a formula cell appear empty after editing?
Some libraries write a formula without calculating its cached result. A recalculation step is needed before tools that read cached values can see a refreshed value.
Does recalculation prove the workbook is right?
No. A wrong cell reference or assumption may still calculate successfully. Compare representative results with independently checked expectations.
Why does recalculation report that soffice cannot be found?
The recalculation helper needs LibreOffice. Make its soffice executable available on the path used by the helper, then rerun it on the output workbook. A report containing an error instead of a status means the values were not recalculated.
How should I write MAXIFS with openpyxl so the formula survives recalculation?
Use _xlfn.MAXIFS in the formula you write. Excel hides the prefix in its interface, but openpyxl stores the name you supply. Test one row against a known result before filling the rest of the column.