Skill Claude Skill

xlsx

A skill for creating, editing and analyzing spreadsheet files (.xlsx, .xlsm, .csv, .tsv) with openpyxl and pandas, recalculating via LibreOffice to catch formula errors.

xlsx preview image

What it is

The xlsx skill guides an agent through reading, creating, editing, cleaning and converting spreadsheet files whenever a spreadsheet is the primary input or output. It prescribes openpyxl for formulas and formatting, pandas for bulk data, and markitdown for quick looks. A mandatory recalculation step with scripts/recalc.py (LibreOffice) reports formula errors. It also sets rules for output quality and financial-model conventions.

Who it's for

  • Users who need spreadsheet files created, edited, cleaned or converted by an AI agent
  • Analysts building formula-driven workbooks or financial models
  • Anyone restructuring messy tabular data (malformed rows, misplaced headers, junk data) into proper spreadsheets

Requirements

Requirements

  • openpyxl, pandas and markitdown (preinstalled; install only if an import fails or the command is missing)
  • LibreOffice (soffice), auto-configured via scripts/office/soffice.py
  • Python, to run scripts/recalc.py
  • The deliverable must be a spreadsheet file

Setup

  1. Recalculate a workbook with formulas

    Run recalc.py after writing formulas, because openpyxl stores no cached values. The file is rewritten in place and JSON is returned with status, total_formulas, total_errors and error_summary. The timeout defaults to 30 seconds.

    bash
    python scripts/recalc.py output.xlsx [timeout_seconds]   # default 30

Examples

Write a formula instead of a computed value

python
python
sheet['B10'] = '=SUM(B2:B9)'

What it does: The skill requires formulas rather than hardcoded Python-computed results, so the sheet recalculates when inputs change.

Quote sheet names with spaces

python
python
='Assumptions Inputs'!$B$5

What it does: A cross-sheet reference to a sheet name containing a space must be quoted, or it evaluates to #VALUE!.

Use the _xlfn. prefix for post-2007 functions

text
text
_xlfn.TEXTJOIN, _xlfn.CONCAT, _xlfn.IFS, _xlfn.SWITCH, _xlfn.MAXIFS, _xlfn.MINIFS

What it does: These six work only with the prefix; written bare they yield #NAME?.

Quick look at a sheet

bash
bash
markitdown file.xlsx

What it does: Outputs a ## SheetName section per sheet and reads .xlsm too. It gives no cell coordinates, so don't plan edits from it.

Pros & cons

Pros

  • Pro:Mandatory recalc step with JSON error reporting catches formula errors before delivery
  • Pro:Detailed openpyxl gotchas (data_only, merged cells, keep_vba, quoted sheet names) prevent common silent mistakes
  • Pro:Clear formula guidance avoids functions LibreOffice cannot evaluate, such as XLOOKUP and FILTER
  • Pro:Includes financial-model conventions for colors, number formats and assumption handling

Cons

  • Con:Cannot use XLOOKUP, XMATCH, SORT, FILTER, UNIQUE or SEQUENCE; sorting and filtering must be done in Python
  • Con:A clean recalc only proves formulas evaluate, not that they are correct, so manual checks are needed
  • Con:Re-saving workbooks with external links via openpyxl and recalculating loses those links; recalc.py refuses unless --force is used

Images