文档办公

xlsx

appautomaton/do…t-skills

Create, edit, analyze, and recalculate Excel workbooks (.xlsx, .xlsm) with live formulas, formatting, and charts. Use when a task produces or modifies a spreadsheet file, turns CSV/TSV data into one, or needs values, formulas, or formatting read from one.

  • 1317 次安装
  • 177 星标
  • 收录于

安装命令

npx skills add https://github.com/appautomaton/document-skills --skill xlsx

SKILL.md

Excel workbooks

You already know openpyxl and pandas. This skill adds what you can't see from the code: a recalculation step that reports what is actually wrong in the workbook, and the behaviours of openpyxl and LibreOffice that silently break files.

Running scripts

<skill> is the directory containing this file. Run bundled scripts by absolute path from the user's working directory, so relative paths to their files keep working:

uv run <skill>/scripts/recalc.py model.xlsx

Run Python you write with its dependencies declared, either uv run --with openpyxl script.py or a PEP 723 header. Recalculation needs LibreOffice (soffice).

Choosing a tool

  • openpyxl for any workbook you deliver: formulas, formatting, charts, validation, comments. It keeps charts, images, comments, data validation and conditional formatting of files it loads. It drops what it does not model, such as shapes, text boxes, slicers and form controls, so check before editing a workbook that has them.
  • pandas for analysis and bulk reads. Its writer keeps only values, so never use it to edit a workbook someone will keep working in.
  • For .xlsm, load with load_workbook(path, keep_vba=True), or the macros are lost on save.