agentleFS
nb-99nb-99/skillektion/skills/xlsx/SKILL.md

xlsx

Skill1 starsChanged 3 months agoMITView on GitHub

Create, edit, and verify Excel workbooks (.xlsx/.xlsm/.ods) with openpyxl, pandas, and a LibreOffice recalculation pass. Use when building or editing spreadsheets with formulas, formatting, or multiple sheets, or when a task mentions xlsx, Excel, workbook, spreadsheet, financial model, or openpyxl. Not for plain CSV/TSV files or Google Sheets — handle those as text or with their own tooling.

  • Installs packages

194 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use Video Generation, VLM and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • huang-x-hSkill

    Video Generation

    Implement AI-powered video generation capabilities using the z-ai-web-dev-sdk. Use this skill when the user needs to generate videos from text prompts or images, create video content programmatically, or build applications that produce video outputs. Supports asynchronous task management with status polling and result retrieval.

    Also in 6 projects that use this

  • huang-x-hSkill

    VLM

    Implement vision-based AI chat capabilities using the z-ai-web-dev-sdk. Use this skill when the user needs to analyze images, describe visual content, or create applications that combine image understanding with conversational AI. Supports image URLs and base64 encoded images for multimodal interactions.

    Also in 6 projects that use this

  • dav-niu474Skill

    gift-evaluator

    The PRIMARY tool for Spring Festival gift analysis and social interaction generation. Use this skill when users upload photos of gifts (alcohol, tea, supplements, etc.) to inquire about their value, authenticity, or how to respond socially. Integrates visual perception, market valuation, and HTML card generation.

    Also in 5 projects that use this

  • dav-niu474Skill

    Podcast Generate

    Generate podcast episodes from user-provided content or by searching the web for specified topics. If user uploads a text file/article, creates a dual-host dialogue podcast (or single-host upon request). If no content is provided, searches the web for information about the user-specified topic and generates a podcast. Duration scales with content size (3-20 minutes, ~240 chars/min). Uses z-ai-web-dev-sdk for LLM script generation and TTS audio synthesis. Outputs both a podcast script (Markdown) and a complete audio file (WAV).

    Also in 5 projects that use this

  • Liang-MHSkill

    stock_analysis

    获取 A 股、基金和港股的实时行情和技术分析数据

    Also in 5 projects that use this

  • SeifBenayedSkill

    file-reading

    Use this skill when a file has been uploaded but its content is NOT in your context — only its path at /mnt/user-data/uploads/ is listed in an uploaded_files block. This skill is a router: it tells you which tool to use for each file type (pdf, docx, xlsx, csv, json, images, archives, ebooks) so you read the right amount the right way instead of blindly running cat on a binary. Triggers: any mention of /mnt/user-data/uploads/, an uploaded_files section, a file_path tag, or a user asking about an uploaded file you have not yet read. Do NOT use this skill if the file content is already visible in your context inside a documents block — you already have it.

    Also in 5 projects that use this

  • +1 more from huang-x-h
  • +5 more from dav-niu474

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 3 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 188 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Document assumptions next to where they are used: Every hardcoded number (growth rate, tax band, conversion factor) gets a labeled cell of …

    line 66
  2. Very specific:

    Merged cells: write the top-left anchor only.

    line 88
  3. Very specific:

    Sheet names with spaces must be quoted in references: write ='My Data'!A1, never =My Data!A1.

    line 94
  4. Very specific:

    If you must edit one, copy the linked cells' cached values into normal cells first (they are readable with data_only=True before you touch …

    line 102
  5. Very specific:

    Before building out a grid, spot-check two or three cells against values you computed by hand (or with pandas) — read back with …

    line 142
  6. Very specific:

    Prefer Excel-2007-era functions: SUMIFS, COUNTIFS, AVERAGEIFS, INDEX, MATCH, IFERROR, SUMPRODUCT, TEXT.

    line 161
  7. Very specific:

    Avoid XLOOKUP, XMATCH, SORT, FILTER, UNIQUE, SEQUENCE when LibreOffice is your evaluator.

    line 169
  8. Distinctive:

    When a model is the deliverable, follow the conventions reviewers expect (unless the file you are editing already does it differently):

    line 183
  9. Very specific:

    Every assumption in its own labeled cell (see above), projection periods share one consistent formula dragged across, and every division …

    line 193
  10. Distinctive:

    When layout or formatting matters, render and look:

    line 208
  11. Very specific:

    Check availability first (command -v ..., python3 -c "import ...", soffice --version), install only what is missing:

    line 218

“Common” is measured: kept by at least 6 in 10 of the 188 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Excel workbooks (.xlsx, .xlsm, .ods)

Build and edit workbooks with openpyxl, move bulk data with pandas, and make a LibreOffice recalculation pass part of every delivery that contains formulas. A workbook whose formulas have never been evaluated is not a finished deliverable: openpyxl writes formulas as strings and leaves no computed values behind, so the file looks empty to every reader until something recalculates and saves it.

TaskApproach
Create or edit cells, formulas, formattingopenpyxl — values are plain assignments, formulas are strings starting with =
Bulk data in/out (tables, exports)pandas read_excel / to_excel, then openpyxl for formulas and formatting
Quick look at what is insidescripts/dump.py FILE — per-sheet text dump
Read a model: formulas AND valuestwo load_workbook passes (see below)
Deliver anything with formulasscripts/recalc.py FILE, then spot-check a few cells

Read before you write

Reading a workbook is two different files depending on how you load it, and mixing them up destroys work:

from openpyxl import load_workbook

wf = load_workbook(path)                  # formulas as stored: B2 = "=SUM(A1:A2)"
wv = load_workbook(path, data_only=True)  # cached values only:  B2 = 100
  • data_only=True returns the cached result of each formula and no formulas; the default load returns formulas and no values. To understand a model you were handed — what it computes and what it currently shows — you need both passes.
  • Never save a workbook you loaded with data_only=True. Saving writes the cached numbers as literal cell values and every formula in the file is gone. Load a fresh handle with defaults for anything you intend to write.
  • A file written by openpyxl (or never opened and saved by a spreadsheet app) has no cached values at all: data_only=True reads None for every formula cell, and pandas.read_excel shows them as NaN. That is the normal state of your own work-in-progress, not a bug — it is why the recalc pass exists.
  • scripts/dump.py gives a fast text view (ADDR formula -> cached value), marks formulas that have no cached value yet, and shows merged ranges and sheet dimensions. Use it instead of opening Excel when someone asks "what's in this file?". It needs openpyxl on python3: python3 scripts/dump.py model.xlsx --sheet Assumptions.
  • pandas is the right tool for bulk rows (read_excel with sheet_name, usecols, skiprows; to_excel with index=False). openpyxl is the right tool for structure: formulas, number formats, merged cells, charts. Neither replaces the other.

Writing workbooks that stay honest

  • Formulas, not hardcoded results. A total must be =SUM(...) so it moves when its inputs move. If you compute a number in Python and write the literal, the workbook silently lies the first time someone edits an input. Compute in the sheet; use Python only for data prep and verification.
  • Follow the spec exactly. Tab names, header wording, column order, the user's own formulas — reproduce them, even when you would have phrased it differently. If the user wrote =B5*B6, do not "improve" it into a named range.
  • Document assumptions next to where they are used. Every hardcoded number (growth rate, tax band, conversion factor) gets a labeled cell of its own, referenced by formulas — never buried inside a formula body. Cite the real source in an adjacent note when one exists ("FY25 budget p.12"), and say so plainly when an assumption is yours.
  • A workbook built for someone to fill in needs a legend: which cells are editable (and how they are marked), plus one example row showing a filled-in result. Add that example row only when you are creating the file or were asked for it — never add example data to a file you were merely asked to edit.
  • When editing an existing file, follow its conventions, not generic best practice. Workbooks often mark designated input cells by fill or font color; find that scheme (read the file, ask for a screenshot of the "yellow cells" rule), write only into designated input areas, and leave every existing formula untouched unless the task says otherwise.

openpyxl gotchas

  • Formula cells carry no cached value until a real spreadsheet app recalculates and saves. Readers (pandas, data_only=True, Quick Look, most web previewers) see None/NaN. Fix at delivery time with scripts/recalc.py, not by writing values yourself.
  • Merged cells: write the top-left anchor only. Every other cell in the merged range is a read-only MergedCell — assigning ws["B2"].value in a merged A1:B2 raises AttributeError. Reading the range back, non-anchor cells are None.
  • .xlsm needs keep_vba=True: load_workbook(path, keep_vba=True). Re-saving without it drops the VBA project from the file.
  • Sheet names with spaces must be quoted in references: write ='My Data'!A1, never =My Data!A1. LibreOffice cannot parse the unquoted form — it rewrites the formula lowercased and the cell evaluates to #VALUE!. Quote defensively (single quotes are always legal, even when the name has no space).
  • External links do not survive an openpyxl re-save, and a LibreOffice recalc of a file with dead external links replaces the linked cells with #NAME? and deletes the links. recalc.py refuses such files by default. If you must edit one, copy the linked cells' cached values into normal cells first (they are readable with data_only=True before you touch anything).
  • Assigning a non-string to a cell writes a value; assigning a string starting with = writes a formula. ws["A1"] = "=SUM(B1:B10)" is a formula; "=text" as text needs a leading apostrophe or an explicit data_type.

Recalculate before delivering

scripts/recalc.py (stdlib only) opens the file in headless LibreOffice, recalculates everything, saves it in place — formulas now carry cached values — and reports formula errors as JSON:

$ python3 scripts/recalc.py model.xlsx
{
  "status": "errors_found",        # or "success"
  "total_formulas": 7,
  "total_errors": 2,
  "error_summary": [{"error": "#NAME?", "cells": ["Report.B8"]}],
  "file": "model.xlsx",
  "engine": "uno"
}
  • Exit codes: 0 when the file was recalculated (errors_found still exits 0 — fixing errors is your job, the JSON names the cells), 2 when it refused (external links, unreadable file), 1 on failure or timeout (default 30 s, --timeout to override; a killed LibreOffice leaves no lock behind).
  • It drives LibreOffice over a UNO socket, preferring the interpreter LibreOffice ships with (which can import uno); if none can, it falls back to a convert-to roundtrip with recalc-on-load forced on and a warning that error counts are unavailable — treat "total_errors": null as "not checked", and verify by reading values back yourself.
  • It refuses workbooks containing external references (scan of the package's externalLinks parts and '[N]-style formulas) unless --force, because recalculation cannot resolve the missing file: the cells turn #NAME? and the links are deleted. Copy cached values out first, or pass --force with open eyes.
  • A clean recalc proves the formulas evaluate, not that they are right: an off-by-one range reads back error-free with wrong numbers. Before building out a grid, spot-check two or three cells against values you computed by hand (or with pandas) — read back with data_only=True and compare. Trust total_errors over the summary's shape; both name exact cells.
  • LibreOffice re-serializes the file when it saves. Day-to-day formatting, formulas, and charts survive; exotic features (pivot tables, some chart types, external links) may not. Keep the original until you have diffed what matters.
  • On macOS, a LibreOffice install whose bundled Python refuses to launch (code-signing launch constraints) simply falls through to the convert-to fallback — the JSON tells you which engine ran.

Formula compatibility

LibreOffice is the evaluator in your verification loop, and it implements a smaller function set than Excel. One function it cannot evaluate becomes a literal #NAME? baked into the delivered file — every future reader sees the error, not just your LibreOffice.

  • Prefer Excel-2007-era functions: SUMIFS, COUNTIFS, AVERAGEIFS, INDEX, MATCH, IFERROR, SUMPRODUCT, TEXT. They evaluate everywhere.
  • Functions added after 2007 (TEXTJOIN, CONCAT, IFS, SWITCH, MAXIFS, MINIFS) must be written with the _xlfn. prefix: =_xlfn.TEXTJOIN(",",TRUE,A1:A4). openpyxl stores the formula verbatim; Excel stores those names prefixed internally and hides the prefix in its UI, so the prefix is not lost on Excel users. LibreOffice maps the prefixed name and evaluates it; the bare name evaluates to #NAME?.
  • Avoid XLOOKUP, XMATCH, SORT, FILTER, UNIQUE, SEQUENCE when LibreOffice is your evaluator. Support varies by version, and where they do evaluate they are spilling array functions — an openpyxl-written file carries no spill metadata, so at worst only the anchor cell of the intended range gets a value, and the error count stays at zero. Use INDEX/MATCH and do sorting, filtering, and deduplication in Python.
  • Two useful tells in a recalculated file: a formula LibreOffice could not parse comes back lowercased (=My Data!A1 → =my Data!A1), and a hand-written #REF! inside a formula text may import as #NAME? — a genuine #REF! (for example =INDIRECT("NoSheet!A1")) reports as #REF!. Either way the cell is an error; fix the formula, not the symptom.

Financial modeling conventions

When a model is the deliverable, follow the conventions reviewers expect (unless the file you are editing already does it differently):

  • Color code: blue text for hardcoded inputs, black for same-sheet formulas, green for cross-sheet links, red for cross-file links. Reviewers will look for it.
  • Currency formats with the unit named in the header (Amount ($000) — the format shows thousands, the header says so). Negatives in parentheses: #,##0;(##,##0). Percentages are stored as fractions — 0.15 renders 15.0%; storing 15 renders 1500%.
  • Every assumption in its own labeled cell (see above), projection periods share one consistent formula dragged across, and every division guards its denominator (=IF(B5=0,0,B4/B5) or IFERROR).
  • Number-format strings go on cells (cell.number_format = "#,##0.00"), not on values.

Verify the output

  1. python3 scripts/recalc.py FILE — read status and error_summary; fix every named cell and rerun until success.
  2. Spot-check: reload with data_only=True and compare two or three formulas against hand-computed values (or a pandas cross-total). A clean recalc is not a correctness proof.
  3. Independent read-back: pd.read_excel(FILE, sheet_name=...) — if pandas sees NaN where a formula should be, the file was never recalculated.
  4. When layout or formatting matters, render and look:
    soffice --headless --convert-to pdf --outdir /tmp/x FILE.xlsx
    pdftoppm -png -r 60 /tmp/x/FILE.pdf /tmp/x/page     # poppler-utils
    then read the PNGs. qpdf --check validates the PDF if you need a machine check.

Dependencies

Check availability first (command -v ..., python3 -c "import ...", soffice --version), install only what is missing:

  • openpyxl, pandas: pip install openpyxl pandas (any Python ≥3.9). scripts/dump.py needs openpyxl on the interpreter that runs it.
  • LibreOffice (recalculation + PDF render): soffice must be on PATH or passed via --soffice. Get it from https://www.libreoffice.org/download (macOS/Windows) or the system package manager (apt install libreoffice-calc libreoffice-script-provider-python / python3-uno on Debian/Ubuntu, dnf install libreoffice-calc, brew install --cask libreoffice on macOS). The Linux distro packages often split the UNO Python bridge into a separate package — install it so recalc.py can count errors instead of falling back.
  • poppler-utils (pdftoppm) and qpdf — optional, only for the visual-verification loop; any system package manager has them.

Scripts never make network calls. Keep scratch files outside the skill directory.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.