
document-xlsx
Builds Excel charts, pivots, validation, exports, Office Scripts/Graph automation, and workbook audits. Use when automating workbooks; for plain edits prefer official xlsx skill.
- Installs
- 875
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/vasilyu1983/ai-agents-public --skill document-xlsx- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads document-xlsx automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Document XLSX Skill - Quick Reference
Boundary: when the official Anthropic xlsx skill is available, prefer it for plain create/edit, formula-first financial models, LibreOffice recalculation (recalc.py) and formula-error scans. Use this skill for its specialist lanes:
- native charts, pivots, data validation and conditional formatting
- Office Scripts, Microsoft Graph and xlwings automation
- very large (
write_only/read_only) files - untrusted-workbook audit and sanitising
Core Decision Rules
- Decide the runtime first: local file generation, cloud workbook automation (Microsoft 365), desktop Excel automation, or audit and sanitising.
XlsxWriteris write-only. It cannot open or edit an existing.xlsx. For "edit this workbook", useopenpyxl(or ExcelJS in Node). Picking XlsxWriter for an edit task fails immediately.- Table-first exports: headers in one row, a named Excel Table, a frozen header row and bounded ranges. The table brings its own autofilter, so a separate
autofilter()over the same range raisesOverlappingRange. - Libraries write formulas; a calculation engine computes them. openpyxl does not evaluate formulas; XlsxWriter normally writes a placeholder cached
0and requests recalculation, or accepts an explicitly supplied result. A nonblank cache is not calculation evidence. Keep formulas, recalculate in the target engine, and independently compute any result needed before that step. See XlsxWriter formula results. - Future functions need their specified OOXML spelling. With openpyxl, check the function's required prefix in the writer's future-function list;
openpyxl.utils.FORMULAEis not a compatibility test. Default to XlsxWriterwrite_dynamic_array_formulafor spill formulas. If the recipient's Excel build is unknown, preferINDEX/MATCHand nestedIF. Load references/excel-formulas.md when writing future or array functions or reading cached results. - Library defaults fail open. Set them explicitly:
- Set validation error alerts and
errorStyle="stop"explicitly for Excel entry checks; openpyxl itself never validates assigned values. Check inputs in code too. - XlsxWriter turns strings that start with
=into formulas unlessstrings_to_formulasis off. - XlsxWriter
add_tablewarns and returns a negative code instead of raising.
- Set validation error alerts and
- Native pivots: use Office Scripts (Microsoft 365) or xlwings (desktop Excel). openpyxl and XlsxWriter cannot create them. For headless exports, write pre-computed summary tables.
- Untrusted workbooks: load with
keep_links=Falseandkeep_vba=False, and runscripts/xlsx_audit.pybefore anything else. This skill never authors or executes macros. - Large files: install
lxmland useWorkbook(write_only=True)/load_workbook(read_only=True). Both stream instead of building the full tree. A write-only workbook can be saved exactly once (WorkbookAlreadySaved). - Format ceilings: 1,048,576 rows × 16,384 columns per sheet, set by the file format. Decide pagination or a multi-sheet layout up front.
Quick Reference
| Task | Tool | When |
|---|---|---|
| New table-first export | XlsxWriter (pandas/Polars) | Reports with tables, formats, native charts, dynamic arrays |
| Edit existing workbook | openpyxl | Sheets, formulas, tables, validation, protection |
| Node/TS service | ExcelJS | Structure and styles. For native charts or pivots, check the installed release's documentation and test the required round trip |
| Microsoft 365 workbook | Office Scripts / Microsoft Graph Excel | Native pivots and tables; remote sessions |
| Desktop Excel features | xlwings | A machine with Excel installed; not headless CI |
| Pre-share audit (gate) | scripts/xlsx_audit.py | Exits non-zero on blocking findings |
| Text/link cleanup | scripts/xlsx_sanitize.py | Adds visible apostrophes to risky strings; optionally removes external-link parts. Sanitize CSV at export too |
| Repeatable export | scripts/xlsx_export_report.py | CSV/JSON/Parquet to a table-first .xlsx; input text is never turned into formulas |
Scripts And Exit Codes
python3 scripts/xlsx_audit.py workbook.xlsx --format md # gate
python3 scripts/xlsx_audit.py workbook.xlsx --report-only # inventory; invalid input still exits 2
python3 scripts/xlsx_sanitize.py in.xlsx out.xlsx --strip-external-links
python3 scripts/xlsx_export_report.py data.csv report.xlsx --title "Sales"
python3 scripts/test_xlsx_sanitize.py # atomic output and alias rejection regressions
| Script | 0 | 1 | 2 |
|---|---|---|---|
xlsx_audit.py | No blocking findings (heuristic signals may still need a read) | Blocking findings: cached error values, newer functions without _xlfn., dangerous text, external-link parts, VBA | File missing, not a zip, or not a workbook |
xlsx_sanitize.py / xlsx_export_report.py | Written | n/a | Input missing or unreadable, or the write failed. No partial output is left behind |
Heuristic signals the audit reports but does not block on: hard-coded constants in formulas, hidden or very hidden sheets, HYPERLINK formulas, formulas without cached values. Read them before sharing. The audit is static: it cannot prove formulas evaluate correctly (see the calculation evidence gate below).
Core Operations
Table-First Export (XlsxWriter)
import pandas as pd
with pd.ExcelWriter("report.xlsx", engine="xlsxwriter",
engine_kwargs={"options": {"strings_to_formulas": False}}) as writer:
df.to_excel(writer, sheet_name="Sales", index=False, startrow=1)
workbook, worksheet = writer.book, writer.sheets["Sales"]
header_fmt = workbook.add_format({"bold": True, "bg_color": "#D9E2F3"})
worksheet.write("A1", "Sales report")
worksheet.freeze_panes(2, 0)
# The table brings its own autofilter; a separate worksheet.autofilter() over the
# same range raises OverlappingRange. Rows: header=1, data=2..len(df)+1, totals=len(df)+2.
status = worksheet.add_table(1, 0, len(df) + 2, len(df.columns) - 1, {
"name": "SalesTable",
"style": "Table Style Medium 2",
"total_row": True,
"columns": [{"header": col, "header_format": header_fmt,
**({"total_function": "sum"} if col in ("qty", "total") else {})}
for col in df.columns],
})
if isinstance(status, int) and status < 0: # XlsxWriter warns instead of raising
raise ValueError("add_table rejected the table definition")
If the table range is one row short, the totals row silently overwrites the last data row. See references/excel-tables-structured-references.md.
Edit Existing Workbook Safely (openpyxl)
from openpyxl import load_workbook
wb = load_workbook("input.xlsx", keep_vba=False, keep_links=False)
ws = wb["Sales"]
ws["A1"] = "Sales report"
ws.freeze_panes = "A2"
wb.save("output.xlsx")
Never load with data_only=True and then save: that replaces every formula with its cached value, or with nothing.
Known Limits And Caveats
-
Google Sheets and LibreOffice do not preserve every Excel feature. Verify pivots, dynamic-array formulas, protection and advanced formatting in the target viewer.
-
Data validation is UI metadata; paste can bypass it or replace a cell's rule. Combine validation with protection and checks in code. See openpyxl validation limits.
-
Sheet and workbook protection passwords are deterrents, not encryption. Use file-level encryption or platform access controls for sensitive data. See references/excel-security-protection.md.
-
pandas.read_excel()never surfaces conditional formatting, validation, protection or charts. When the audit needs them, read the OOXML parts directly or use openpyxl. -
Library behaviour changes between releases. Re-test a claimed default (for example a validation or formula option) against the installed version before relying on it.
Default Workflow
- Create: choose the runtime, start from a table-first layout, and keep inputs, calculations and outputs separate.
- Gate:
python3 scripts/xlsx_audit.py out.xlsx --format mdmust exit 0, then review against assets/spreadsheet-model-review-checklist.md. - Ship: sanitise exported text, review external links, run Excel's Accessibility Checker, and open the file in Excel plus the target secondary viewer.
Do / Avoid
Record assumptions with value, unit, source and date; include control totals and check cells. Hidden sheets do not protect PII or secrets.
Calculation Evidence Gate
Define the calculation contract before release: authoritative inputs, the expected formulas or computed values, the calculation engine, the recalculation mode and the control totals. Where formulas matter, reopen the final workbook twice:
- With formulas visible, to check consistency.
- After a named calculation engine has recalculated it, to inspect cached results and error cells (
#REF!,#VALUE!,#DIV/0!,#NAME?,#N/A).
If no calculation engine is available, mark the formula results unverified and provide independently computed control totals. Neither blank caches nor placeholder zeros prove calculation; supply cached values only when independently computed from the authoritative inputs.
Navigation
References
- references/excel-formulas.md -
_xlfn.prefixes, spilling functions, array formulas, reading values back - references/excel-tables-structured-references.md - Table range arithmetic, structured formulas
- references/excel-charts.md - Chart choice, reference wiring, openpyxl chart gotchas
- references/excel-formatting.md - Types before formats, conditional-formatting rules, layout
- references/excel-data-validation.md - Enforced dropdowns, named lists, cascading validation
- references/excel-pivot-tables.md - Native pivots vs pre-computed summaries
- references/excel-security-protection.md - Protection limits, encryption, injection, links
- references/excel-cloud-automation.md - Office Scripts, Microsoft Graph Excel, xlwings
- references/excel-accessibility-compliance.md - Accessibility, Section 508, EN 301 549 lookup
- references/extraction-stack.md - Extraction tool candidates by job, for LLM/RAG pipelines
- data/sources.json - Vendor and standards links
Assets
- assets/financial-report.md - Financial statement rules: linked statements, sign convention, check cells
- assets/data-dashboard.md - Dashboard layout gotchas (merged KPI cards, chart anchoring, hidden data)
- assets/spreadsheet-model-review-checklist.md - Workbook QA checklist
Related Skills
- ../document-pdf/SKILL.md - PDF generation from spreadsheet data
- ../ai-ml-data-science/SKILL.md - Data analysis and dataframe workflows
- ../data-sql-optimization/SKILL.md - Database-to-workbook pipelines
Learnings Loop
When prior decisions or pitfalls are relevant, consult learnings.consolidated.md if present; use learnings.md only for needed history or as the available fallback. Otherwise skip both.
After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.
FAQ
What does the document-xlsx skill do?
Builds Excel charts, pivots, validation, exports, Office Scripts/Graph automation, and workbook audits. Use when automating workbooks; for plain edits prefer official xlsx skill.
How do I install document-xlsx?
Run npx skills add https://github.com/vasilyu1983/ai-agents-public --skill document-xlsx in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/document-xlsx/ (personal) or .claude/skills/document-xlsx/ (project).
Which AI agents can use document-xlsx?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is document-xlsx safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains document-xlsx?
It is published by vasilyu1983 in vasilyu1983/ai-agents-public. It has 875 recorded installs.
More from vasilyu1983/ai-agents-public
software-architecture-design
vasilyu1983/ai-agents-public
Designs runtime topology in a chosen solution. Use when choosing monolith vs services, cells, consistency, ADRs. Not for cross-system design (software-solution-architecture).
product-management
vasilyu1983/ai-agents-public
Guides founder-PM discovery, roadmaps, prioritization, and PMF measurement. Use when planning product strategy, metrics, or roadmaps.
software-ui-ux-design
vasilyu1983/ai-agents-public
Designs and audits UI/UX systems with usability and accessibility requirements. Use when shaping flows, design systems, interaction patterns, or WCAG-aware product behavior.
document-pdf
vasilyu1983/ai-agents-public
Handles PDF/UA accessibility, real redaction, metadata scrubbing, signing, and extraction. Use when redacting or signing PDFs; for plain create/merge prefer the official pdf skill.
qa-testing-playwright
vasilyu1983/ai-agents-public
Builds and debugs Playwright E2E suites. Use when authoring browser tests, fixing flakes, or hardening Playwright CI and locator strategy.
qa-testing-strategy
vasilyu1983/ai-agents-public
Designs risk-based test strategy for software delivery. Use when defining coverage, setting CI gates, managing flaky tests, choosing test layers, or establishing release criteria.
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.