Q&A

Can Claude Code edit Excel files?

Short answer

Yes. Claude Code can read and edit .xlsx files directly using Python (via the openpyxl library) or by converting to CSV. For complex spreadsheets with formulas, charts and formatting, conversion to CSV is often the cleanest path.

Yes, Claude Code can read and edit Excel files, but the approach depends on what you’re trying to do.

Direct .xlsx editing via Python

For most Excel work, Claude Code generates a quick Python script using openpyxl (or pandas for heavier data work) and runs it. Both libraries are mature, well-supported and handle the common cases: reading cells, editing values, applying formulas, saving back to .xlsx.

A typical prompt: “Read products.xlsx. For every row in the ‘Stock’ sheet where ‘Quantity’ is below the value in ‘ReorderPoint’, add the row to a new ‘NeedsReorder’ sheet and highlight the row in the original. Save as products-reordered.xlsx.”

Claude writes the script, runs it, and you have your output. Roughly 30 seconds for a 10k-row workbook.

When CSV is cleaner

For pure data work (no formulas, no formatting, no charts), exporting your data to CSV first is faster and more reliable. Claude reads CSV natively without spinning up Python, and the output is easier to inspect.

Workflow: Excel → File → Save As → CSV → ask Claude to do the work → import back to Excel if needed.

Things to know

  • Formulas: openpyxl preserves formula text but doesn’t recalculate. After Claude edits a file, open it in Excel once to trigger recalc, or use the --data-only flag to read calculated values.
  • Pivot tables and charts: Generally preserved on read/write but get tricky if Claude modifies cells they reference. Test before relying on it.
  • Conditional formatting: Preserved. Mostly.
  • Macros (.xlsm): openpyxl strips them. If you need macros, use a different tool (xlwings) or do the macro work in Excel manually.

On Windows specifically

If you’ve got the file open in Excel, Claude can’t write to it (Windows file lock). Close the file first, or have Claude write to a new file with a date suffix.

Cost

A typical Excel-editing task on Claude Code runs $0.05-0.30 AUD on Sonnet 4.6 with caching. The cost scales with how much data Claude has to read into the prompt, not with the size of the file on disk.

Where this is useful for Australian SMBs

  • Xero data exports in xlsx → cleaning, analysing, reformatting
  • Stock spreadsheets → reorder calculations, low-stock alerts
  • Client billing schedules → bulk updates, mail-merge prep
  • Tax-time data wrangling → quick categorisation across sheets

Want help wiring up a Claude Code workflow that handles your specific Excel grunt-work? Book a free AI audit, we’ll scope it.

Want this built for your business?

Book a free 30-minute AI audit. We'll map your business and show you exactly which systems we'd build first. No pitch deck, no scoping fee.

Book my free AI audit