Back to the collection
xlsx·Productivity

xlsx guide: clean spreadsheets and verify formulas

On this page

Use xlsx when a spreadsheet is the main input or deliverable: clean CSV data, edit a workbook, add formulas or create an analysis sheet. Specify calculation rules and verify recalculated results before delivery.

Install and prepare

Open Claude Code and add the official document skills:

Prompt
/plugin marketplace add anthropics/skills
/plugin install document-skills@anthropic-agent-skills

These commands run in a Claude Code conversation and install the document skill collection. Provide the source file and a destination for the result. The environment needs Python spreadsheet libraries and LibreOffice when formula recalculation is required.

Your first task

Enter this in the agent conversation, adapting the files and goal to your task:

Prompt
Use the xlsx skill on reports/orders.xlsx and save reports/orders-summary.xlsx.
Preserve the original data sheet. Add monthly order counts, revenue, refunds and net revenue, where net revenue = revenue - refunds. Use two decimal places and count refunds in the month they occur. Use formulas, recalculate and spot-check January and December.

Inspect structure and business rules

Inspect sheets, headers, date formats and existing formulas first. Assigning refunds to the order month or the refund month changes the result and requires a business decision. When editing a template, identify its input cells and preserve existing formulas and formatting instead of rebuilding it as a blank workbook.

Check a small formula sample

Have the agent build a few key calculations and check the referenced date, amount and data ranges before filling the whole grid. Keep net revenue as a formula so input edits still propagate. Format money, percentages and dates appropriately and document manual assumptions for future maintenance.

Recalculate and inspect values

Writing formulas with openpyxl does not create cached results, so a successful save does not guarantee visible values in previewers. The workflow uses recalc.py and LibreOffice to calculate them. Read its reported status and error cells, then independently compare monthly results with the source data.

Check before delivery

Open the delivered file to inspect formulas, formatting, widths and key months. Change an input and confirm related totals update. Error-free recalculation shows formulas can execute; it does not prove that business rules or references are correct.

Common questions

Formula results are blank. Cached values may not have been recalculated; check whether recalculation completed.

Is exit code zero enough? No. Inspect the JSON status for errors_found.

The file has external workbook links or macros. Mention them before editing because ordinary save and recalculation workflows can affect these features.

Prove the formula rule on a small sample

For an order summary, choose a month with both refunds and orders crossing a month boundary. Calculate order count, revenue, refunds, and net revenue by hand. Ask the agent to write two or three representative formulas and identify the date column they use. Confirm the accounting rule before extending it to all twelve months; a complete workbook can still use the wrong month definition.

After recalculation, read cached values and compare them with the hand-checked sample. Formula strings alone may mean no cached values exist; numeric results can still be wrong despite a clean recalculation report. When editing a workbook, preserve existing formulas and input-cell conventions, and inspect macros, external links, and merged cells before using a normal save-and-recalculate path.

Make the editable cells obvious

For a new monthly model, label source data, manual inputs, formulas, and output sheets, and include one example input row in the expected format. For an existing template, follow its color and fill conventions instead of inventing new ones. Put assumptions and fixed values where readers can see them, including the origin of tax rates, exchange rates, or refund rules. Someone changing an input should know which results must update. If formulas depend on external workbooks or macros, confirm the save-and-recalculate path first and preserve the original when uncertain.

How did your first task go?

These choices help us understand where readers get stuck through site analytics. Blocking analytics may prevent delivery; use email for a specific issue.

References

  1. XLSX skill specificationAnthropic
  2. Anthropic document skills installationAnthropic
  3. Use Skills in ClaudeAnthropic
Found outdated or incorrect information? Let us know