Office XLSX
Use the bundled scripts in this skill package to produce editable .xlsx
workbooks. The builder writes formulas, styles, bar/column/line/pie charts,
real Excel tables, data validation, conditional formatting, and workbook
recalculation hints. The skill activation metadata includes Skill directory;
treat that as SKILL_DIR and run scripts from SKILL_DIR/scripts/.
Workbook Shape
For nontrivial workbooks, prefer:
- Summary or dashboard sheet first.
- Inputs / assumptions sheet next.
- Detail or source data sheets after that.
- Checks sheet only when formulas, reconciliations, or model integrity matter.
Workflow
- Normalize source data before writing the workbook.
- Use formulas for derived values instead of hardcoded calculated outputs.
Strings beginning with
= are written as Excel formulas.
- For structured workbook creation, create a JSON spec in the working
directory and run:
python3 "$SKILL_DIR/scripts/check_env.py"
python3 "$SKILL_DIR/scripts/build_xlsx.py" --spec spec.json --out output.xlsx
python3 "$SKILL_DIR/scripts/inspect_xlsx.py" --verify output.xlsx
python3 "$SKILL_DIR/scripts/formula_audit.py" output.xlsx
- For CSV/TSV conversion, run one or more inputs into one workbook:
python3 "$SKILL_DIR/scripts/csv_to_xlsx.py" --input data.csv --input lookup.tsv --sheet Data --sheet Lookup --out output.xlsx
python3 "$SKILL_DIR/scripts/inspect_xlsx.py" --verify output.xlsx
- If visual QA matters and LibreOffice is available, run:
python3 "$SKILL_DIR/scripts/render_preview.py" output.xlsx
- To patch an existing workbook without rebuilding it, create a patch JSON and
run:
python3 "$SKILL_DIR/scripts/patch_xlsx.py" --input existing.xlsx --patch patch.json --out output.xlsx
python3 "$SKILL_DIR/scripts/inspect_xlsx.py" --verify output.xlsx
python3 "$SKILL_DIR/scripts/formula_audit.py" output.xlsx --write-cache cached-output.xlsx
Patch actions:
{
"actions": [
{"action": "append_rows", "sheet": "Data", "rows": [["New", 123, "=B2*2"]]},
{"action": "set_cell", "sheet": "Summary", "cell": "B2", "value": "=SUM(Data!B:B)"}
]
}
- When formulas matter, use
formula_audit.py --write-cache and deliver the
cached workbook unless the audit reports unsupported formulas that require
Excel/LibreOffice recalculation. For broad formula coverage, run:
python3 "$SKILL_DIR/scripts/recalculate_xlsx.py" output.xlsx --out recalculated.xlsx
python3 "$SKILL_DIR/scripts/inspect_xlsx.py" --verify recalculated.xlsx
- Deliver the
.xlsx path or attach it with send_attachment.
Spec Shape
{
"title": "Workbook title",
"sheets": [
{
"name": "Summary",
"rows": [["Metric", "Value"], ["Revenue", 1200000], ["Margin", "=B2*0.42"]],
"tables": [{"name": "SummaryTable", "ref": "A1:B3"}],
"data_validations": [{"range": "A2:A10", "type": "list", "formula1": ["Revenue", "Margin"]}],
"conditional_formats": [{"range": "B2:B10", "type": "colorScale"}],
"charts": [
{"type": "column", "title": "Summary", "categories": "$A$2:$A$3", "values": "$B$2:$B$3", "anchor": "D2"},
{"type": "line", "title": "Trend", "categories": "$A$2:$A$3", "values": "$B$2:$B$3", "anchor": "D18"}
],
"column_formats": ["text", "currency"],
"column_widths": [24, 16],
"freeze_top_row": true,
"autofilter": true
}
]
}
Quality Bar
- Keep important values visible; avoid tiny columns and clipped headers.
- Use one workbook, not many disconnected CSV-like sheets, when relationships
between tabs matter.
- Prefer real Excel tables, filters, validations, conditional formats, and
charts when the workbook is meant to be used repeatedly.
- Keep formulas editable, audit formulas before delivery, and write cached
values for supported formulas when possible. Supported audit functions include
common arithmetic, comparisons,
SUM, AVERAGE, MIN, MAX, COUNT,
MEDIAN, ROUND, ABS, and simple IF.
- When patching an existing workbook, preserve unrelated package parts and rerun
inspect_xlsx.py plus formula_audit.py; use recalculate_xlsx.py when the
formula surface exceeds the bundled evaluator.
- If preview rendering fails because LibreOffice or a PDF-to-PNG renderer is
missing, state exactly which verification passed; do not imply visual QA
passed.
1---2name: office-xlsx3description: Use when the user asks to create, inspect, verify, analyze, format, or deliver Excel `.xlsx` workbooks, Google Sheets-targeted spreadsheet artifacts, trackers, budgets, models, tables, dashboards, formulas, CSV/TSV-to-XLSX conversions, or spreadsheet-ready data packs.4---5
6# Office XLSX
7
8Use the bundled scripts in this skill package to produce editable `.xlsx`
9workbooks. The builder writes formulas, styles, bar/column/line/pie charts,
10real Excel tables, data validation, conditional formatting, and workbook
11recalculation hints. The skill activation metadata includes `Skill directory`;
12treat that as `SKILL_DIR` and run scripts from `SKILL_DIR/scripts/`.
13
14## Workbook Shape
15
16For nontrivial workbooks, prefer:
17
181. Summary or dashboard sheet first.
192. Inputs / assumptions sheet next.
203. Detail or source data sheets after that.
214. Checks sheet only when formulas, reconciliations, or model integrity matter.
22
23## Workflow
24
251. Normalize source data before writing the workbook.
262. Use formulas for derived values instead of hardcoded calculated outputs.
27 Strings beginning with `=` are written as Excel formulas.
283. For structured workbook creation, create a JSON spec in the working
29 directory and run:
30
31```bash
32python3 "$SKILL_DIR/scripts/check_env.py"
33python3 "$SKILL_DIR/scripts/build_xlsx.py" --spec spec.json --out output.xlsx
34python3 "$SKILL_DIR/scripts/inspect_xlsx.py" --verify output.xlsx
35python3 "$SKILL_DIR/scripts/formula_audit.py" output.xlsx
36```
37
384. For CSV/TSV conversion, run one or more inputs into one workbook:
39
40```bash
41python3 "$SKILL_DIR/scripts/csv_to_xlsx.py" --input data.csv --input lookup.tsv --sheet Data --sheet Lookup --out output.xlsx
42python3 "$SKILL_DIR/scripts/inspect_xlsx.py" --verify output.xlsx
43```
44
455. If visual QA matters and LibreOffice is available, run:
46
47```bash
48python3 "$SKILL_DIR/scripts/render_preview.py" output.xlsx
49```
50
516. To patch an existing workbook without rebuilding it, create a patch JSON and
52 run:
53
54```bash
55python3 "$SKILL_DIR/scripts/patch_xlsx.py" --input existing.xlsx --patch patch.json --out output.xlsx
56python3 "$SKILL_DIR/scripts/inspect_xlsx.py" --verify output.xlsx
57python3 "$SKILL_DIR/scripts/formula_audit.py" output.xlsx --write-cache cached-output.xlsx
58```
59
60Patch actions:
61
62```json
63{
64 "actions": [
65 {"action": "append_rows", "sheet": "Data", "rows": [["New", 123, "=B2*2"]]},
66 {"action": "set_cell", "sheet": "Summary", "cell": "B2", "value": "=SUM(Data!B:B)"}
67 ]
68}
69```
70
717. When formulas matter, use `formula_audit.py --write-cache` and deliver the
72 cached workbook unless the audit reports unsupported formulas that require
73 Excel/LibreOffice recalculation. For broad formula coverage, run:
74
75```bash
76python3 "$SKILL_DIR/scripts/recalculate_xlsx.py" output.xlsx --out recalculated.xlsx
77python3 "$SKILL_DIR/scripts/inspect_xlsx.py" --verify recalculated.xlsx
78```
79
808. Deliver the `.xlsx` path or attach it with `send_attachment`.
81
82## Spec Shape
83
84```json
85{
86 "title": "Workbook title",
87 "sheets": [
88 {
89 "name": "Summary",
90 "rows": [["Metric", "Value"], ["Revenue", 1200000], ["Margin", "=B2*0.42"]],
91 "tables": [{"name": "SummaryTable", "ref": "A1:B3"}],
92 "data_validations": [{"range": "A2:A10", "type": "list", "formula1": ["Revenue", "Margin"]}],
93 "conditional_formats": [{"range": "B2:B10", "type": "colorScale"}],
94 "charts": [
95 {"type": "column", "title": "Summary", "categories": "$A$2:$A$3", "values": "$B$2:$B$3", "anchor": "D2"},
96 {"type": "line", "title": "Trend", "categories": "$A$2:$A$3", "values": "$B$2:$B$3", "anchor": "D18"}
97 ],
98 "column_formats": ["text", "currency"],
99 "column_widths": [24, 16],
100 "freeze_top_row": true,
101 "autofilter": true
102 }
103 ]
104}
105```
106
107## Quality Bar
108
109- Keep important values visible; avoid tiny columns and clipped headers.
110- Use one workbook, not many disconnected CSV-like sheets, when relationships
111 between tabs matter.
112- Prefer real Excel tables, filters, validations, conditional formats, and
113 charts when the workbook is meant to be used repeatedly.
114- Keep formulas editable, audit formulas before delivery, and write cached
115 values for supported formulas when possible. Supported audit functions include
116 common arithmetic, comparisons, `SUM`, `AVERAGE`, `MIN`, `MAX`, `COUNT`,
117 `MEDIAN`, `ROUND`, `ABS`, and simple `IF`.
118- When patching an existing workbook, preserve unrelated package parts and rerun
119 `inspect_xlsx.py` plus `formula_audit.py`; use `recalculate_xlsx.py` when the
120 formula surface exceeds the bundled evaluator.
121- If preview rendering fails because LibreOffice or a PDF-to-PNG renderer is
122 missing, state exactly which verification passed; do not imply visual QA
123 passed.