must use single quotes (`'$#,##0'`) or heredoc in batch mode. Double quotes cause shell variable expansion.\n\n### Column Width and Row Height\n\n```bash\n# Set column width (character units, ~1 char = 7px)\nofficecli set data.xlsx \"/Sheet1/col[A]\" --prop width=15\nofficecli set data.xlsx \"/Sheet1/col[B]\" --prop width=12\n\n# Set row height (points)\nofficecli set data.xlsx \"/Sheet1/row[1]\" --prop height=20\n\n# Hide column/row\nofficecli set data.xlsx \"/Sheet1/col[D]\" --prop hidden=true\nofficecli set data.xlsx \"/Sheet1/row[5]\" --prop hidden=true\n```\n\nThere is no auto-fit. Set column widths explicitly. Common widths: labels=20-25, numbers=12-15, dates=12, short codes=8-10.\n\n### Freeze Panes\n\n```bash\n# Freeze first row (headers)\nofficecli set data.xlsx \"/Sheet1\" --prop freeze=A2\n\n# Freeze first column and first row\nofficecli set data.xlsx \"/Sheet1\" --prop freeze=B2\n```\n\n### Print Area\n\n```bash\n# Set print area on a sheet\nofficecli set data.xlsx \"/Sheet1\" --prop printArea=\"A1:F20\"\n```\n\n### Data Validation for Input Cells\n\n```bash\n# Dropdown list\nofficecli add data.xlsx /Sheet1 --type validation --prop sqref=\"C2:C100\" --prop type=list --prop formula1=\"Yes,No,Maybe\" --prop showError=true --prop errorTitle=\"Invalid\" --prop error=\"Select from list\"\n\n# Number range\nofficecli add data.xlsx /Sheet1 --type validation --prop sqref=\"D2:D100\" --prop type=decimal --prop operator=between --prop formula1=0 --prop formula2=100 --prop showError=true --prop error=\"Enter 0-100\"\n```\n\nAlways add data validation on input cells in financial models and trackers. It prevents data entry errors.\n\n### Print Area and Page Setup\n\nFor print-ready workbooks, set appropriate column widths and row heights. Consider which sheets need headers repeated on each page.\n\n---\n\n## QA (Required)\n\n**Assume there are problems. Your job is to find them.**\n\nYour first spreadsheet build is almost never correct. Approach QA as a bug hunt, not a confirmation step. If you found zero issues on first inspection, you were not looking hard enough.\n\n### Content QA\n\n```bash\n# Extract text, check for missing data\nofficecli view data.xlsx text\n\n# Check structure\nofficecli view data.xlsx outline\n\n# Check for issues (broken formulas, missing refs, empty sheets)\nofficecli view data.xlsx issues\n\n# Verify formulas exist where expected\nofficecli query data.xlsx 'cell:has(formula)'\n\n# Check for formula errors in cell values\nofficecli query data.xlsx 'cell:contains(\"#REF!\")'\nofficecli query data.xlsx 'cell:contains(\"#DIV/0!\")'\nofficecli query data.xlsx 'cell:contains(\"#VALUE!\")'\nofficecli query data.xlsx 'cell:contains(\"#NAME?\")'\nofficecli query data.xlsx 'cell:contains(\"#N/A\")'\n```\n\nWhen editing templates, check for leftover placeholders:\n\n```bash\nofficecli query data.xlsx 'cell:contains(\"{{\")'\nofficecli query data.xlsx 'cell:contains(\"xxxx\")'\nofficecli query data.xlsx 'cell:contains(\"placeholder\")'\n```\n\n### Formula Verification Checklist\n\n- [ ] Test 2-3 sample cell references: verify they pull correct values\n- [ ] Column mapping: confirm cell references point to intended columns\n- [ ] Row offsets: check formula ranges include all data rows\n- [ ] Division by zero: verify denominators are non-zero or wrapped in IFERROR\n- [ ] Cross-sheet references: use correct `Sheet1!A1` format\n- [ ] Cross-sheet formula escaping: run `officecli get` on 2-3 cross-sheet formula cells and confirm no `\\!` in the formula string. If `\\!` is present, the formula is broken -- delete and re-set using batch/heredoc.\n- [ ] Named ranges: verify `ref` values match actual data locations\n- [ ] Edge cases: test with zero values, negative numbers, empty cells\n- [ ] **Chart data vs formula results**: for every chart with hardcoded/inline data, verify each data point matches the corresponding formula cell result. Use `officecli get` on the source cells and compare against chart series values. Mismatches here are silent data integrity bugs.\n\n### Validation\n\n```bash\nofficecli validate data.xlsx\n```\n\n### Pre-Delivery Checklist\n\n- [ ] Metadata set (title, author)\n- [ ] All formula cells contain formulas (not hardcoded values)\n- [ ] No formula error values (#REF!, #DIV/0!, #VALUE!, #NAME?, #N/A)\n- [ ] Number formats applied (currency, percentage, dates)\n- [ ] Column widths set explicitly (no default 8.43)\n- [ ] Header row styled (bold, fill, freeze panes)\n- [ ] Data validation on input cells\n- [ ] Charts have titles and readable axis labels\n- [ ] **Chart data matches source cells** -- charts with hardcoded/inline data can drift from formula results. For each chart, verify every data point against the corresponding cell value. Prefer cell-range references (`series1.values=\"Sheet1!B2:B6\"`) over inline data to avoid transcription errors.\n- [ ] Named ranges defined for key assumptions\n- [ ] Document validates with `officecli validate`\n- [ ] No placeholder text remaining\n- [ ] Comments on hardcoded assumption values documenting their source\n\n**NOTE**: Unlike pptx (SVG/HTML), xlsx has no visual preview mode. Verification relies on `view text`, `view annotated`, `view stats`, `view issues`, `validate`, and formula queries. For visual verification, the user must open the file in Excel.\n\n### Verification Loop\n\n1. Generate workbook\n2. Run `view issues` + `view annotated` (sample ranges) + `validate`\n3. Run formula error queries (all 5 error types)\n4. List issues found (if none found, look again more critically)\n5. Fix issues\n6. Re-verify affected areas -- one fix often creates another problem\n7. Repeat until a full pass reveals no new issues\n\n**Do not declare success until you have completed at least one fix-and-verify cycle.**\n\n---\n\n## Common Pitfalls\n\n| Pitfall | Correct Approach |\n|---------|-----------------|\n| `--name \"foo\"` | Use `--prop name=\"foo\"` -- all attributes go through `--prop` |\n| Guessing property names | Run `officecli xlsx set cell` to see exact names |\n| `\\n` in shell strings | Use `\\\\n` for newlines in `--prop text=\"line1\\\\nline2\"` |\n| Modifying an open file | Close the file in Excel first |\n| Hex colors with `#` | Use `FF0000` not `#FF0000` -- no hash prefix |\n| Paths are 1-based | `\"/Sheet1/row[1]\"`, `\"/Sheet1/col[1]\"` -- XPath convention |\n| `--index` is 0-based | `--index 0` = first position -- array convention |\n| Unquoted `[N]` in zsh/bash | Shell glob-expands `/Sheet1/row[1]` -- always quote paths: `\"/Sheet1/row[1]\"` |\n| Sheet names with spaces | Quote the full path: `\"/My Sheet/A1\"` |\n| Formula prefix `=` | OfficeCLI strips the `=` -- use `formula=\"SUM(A1:A10)\"` not `formula=\"=SUM(A1:A10)\"` |\n| Cross-sheet `!` in formulas | **CRITICAL:** The `!` in `Sheet1!A1` can be corrupted by shell quoting. Use batch/heredoc for cross-sheet formulas, or double quotes: `--prop \"formula==Sheet1!A1\"`. NEVER use single quotes for formulas containing `!`. After setting, verify with `officecli get` that the formula shows `Sheet1!A1` (no backslash before `!`). |\n| Hardcoded calculated values | Use `--prop formula=\"SUM(B2:B9)\"` not `--prop value=5000` |\n| `
officecli-xlsx · Skills-SI マーケット
and `'` in batch JSON | Use heredoc: `cat \u003c\u003c'EOF' \\| officecli batch` -- single-quoted delimiter prevents shell expansion |\n| Number format with `
officecli-xlsx · Skills-SI マーケット
| Shell interprets `
officecli-xlsx · Skills-SI マーケット
-- use single quotes: `numFmt='$#,##0'` |\n| Year displayed as \"2,026\" | Set cell type to string: `--prop type=string` or use `numFmt=\"@\"` |\n\n---\n\n## Performance: Resident Mode\n\n**Always use `open`/`close` — it is the smart default, not a special-case optimization.** Every command benefits: no repeated file I/O, no repeated parse/serialize cycles.\n\n```bash\nofficecli open data.xlsx # Load once into memory\nofficecli add data.xlsx ... # All commands run in memory — fast\nofficecli set data.xlsx ...\nofficecli close data.xlsx # Write once to disk\n```\n\nUse this pattern for every workbook build, regardless of command count.\n\n## Performance: Batch Mode\n\n```bash\ncat \u003c\u003c'EOF' | officecli batch data.xlsx\n[\n {\"command\":\"set\",\"path\":\"/Sheet1/A1\",\"props\":{\"value\":\"Revenue\",\"bold\":\"true\",\"fill\":\"1F4E79\",\"font.color\":\"FFFFFF\"}},\n {\"command\":\"set\",\"path\":\"/Sheet1/B1\",\"props\":{\"value\":\"Q1\",\"bold\":\"true\",\"fill\":\"1F4E79\",\"font.color\":\"FFFFFF\"}}\n]\nEOF\n```\n\nBatch supports: `add`, `set`, `get`, `query`, `remove`, `move`, `swap`, `view`, `raw`, `raw-set`, `validate`.\n\nBatch fields: `command`, `path`, `parent`, `type`, `from`, `to`, `index`, `after`, `before`, `props` (dict), `selector`, `mode`, `depth`, `part`, `xpath`, `action`, `xml`.\n\n`parent` = container to add into (for `add`). `path` = element to modify (for `set`, `get`, `remove`, `move`, `swap`).\n\nBatch mode executes multiple operations in a single open/save cycle.\n\n---\n\n## Known Issues\n\n| Issue | Workaround |\n|---|---|\n| **Chart series cannot be added after creation** | `set --prop data=` and `set --prop seriesN=` on an existing chart can only update existing series. To add series, delete and recreate: `officecli remove data.xlsx \"/Sheet1/chart[1]\"` then `officecli add` with all series. |\n| **No visual preview** | Unlike pptx (SVG/HTML), xlsx has no built-in rendering. Use `view text`/`view annotated`/`view stats`/`view issues` for verification. Users must open in Excel for visual check. |\n| **Formula cached values for new formulas** | OfficeCLI writes formula strings natively. For newly added formulas, the cached value may not update until the file is opened in Excel/LibreOffice. Existing formula cached values are preserved. |\n| **No auto-fit column width** | No \"auto-fit\" column width based on content. Set `width` explicitly on each column. |\n| **Shell quoting in batch with echo** | `echo '...' \\| officecli batch` fails when JSON values contain apostrophes or `
officecli-xlsx · Skills-SI マーケット
. Use heredoc: `cat \u003c\u003c'EOF' \\| officecli batch data.xlsx`. |\n| **Batch intermittent failure** | Batch+resident mode has a high failure rate (up to 1-in-3 in some sessions). For maximum reliability: (1) prefer batch WITHOUT resident mode, (2) keep batches to 8-12 operations, (3) always check batch output for failures, (4) retry failed operations individually. For critical formulas (especially cross-sheet), consider using individual `set` commands which have 100% reliability. |\n| **Data bar default min/max invalid** | Creating a data bar without `--prop min=N --prop max=N` produces empty `val` attributes in cfvo elements, which may be rejected by strict XML validators or Excel. Always specify explicit min and max values. |\n| **Cell protection requires sheet protection** | `locked` and `formulahidden` properties only take effect when the sheet itself is protected. |\n\n---\n\n## Help System\n\n**When unsure about property names, value formats, or command syntax, run help instead of guessing.** One help query is faster than guess-fail-retry loops.\n\n```bash\nofficecli xlsx set # All settable elements and their properties\nofficecli xlsx set cell # Cell properties in detail\nofficecli xlsx set cell.font # Specific property format and examples\nofficecli xlsx add # All addable element types\nofficecli xlsx view # All view modes\nofficecli xlsx get # All navigable paths\nofficecli xlsx query # Query selector syntax\n```\n","licenseDocuments":[]}}
Use this skill any time a .xlsx file is involved -- as input, output, or both. This includes: creating spreadsheets, financial models, dashboards, or trackers; reading, parsing, or extracting data from any .xlsx file; editing, modifying, or updating existing workbooks; working with formulas, charts, pivot tables, or templates; importing CSV/TSV data into Ex…
Independent GitHub snapshot · Automated classification · Original documentation governs
name: officecli-xlsx
description: "Use this skill any time a .xlsx file is involved -- as input, output, or both. This includes: creating spreadsheets, financial models, dashboards, or trackers; reading, parsing, or extracting data from any .xlsx file; editing, modifying, or updating existing workbooks; working with formulas, charts, pivot tables, or templates; importing CSV/TSV data into Excel format. Trigger whenever the user mentions 'spreadsheet', 'workbook', 'Excel', 'financial model', 'tracker', 'dashboard', or references a .xlsx/.csv filename."
OfficeCLI XLSX Skill
BEFORE YOU START (CRITICAL)
If officecli is not installed:
macOS / Linux
if ! command -v officecli >/dev/null 2>&1; then
curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash
fi
Run commands one at a time. Do not write all commands into a shell script and execute it as a single block.
OfficeCLI is incremental: every add, set, and remove immediately modifies the file and returns output. Use this to catch errors early:
One command at a time, then read the output. Check the exit code before proceeding.
Non-zero exit = stop and fix immediately. Do not continue building on a broken state.
Verify after structural operations. After adding a sheet, chart, pivot table, or named range, run get or validate before building on top of it.
Running a 50-command script all at once means the first error cascades silently through every subsequent command. Running incrementally means the failure context is immediate and local — fix it and move on.
Reading & Analyzing
Text Extraction
officecli view data.xlsx text
officecli view data.xlsx text --start 1 --end 50 --cols A,B,C
Plain text dump, tab-separated per row, with [/Sheet1/row[N]] prefixes. Flags: --mode, --start N, --end N, --max-lines N, --cols A,B,C.
Structure Overview
officecli view data.xlsx outline
Sheets with row/column counts and formula counts per sheet.
Detailed Inspection
officecli view data.xlsx annotated
Cell values with type/formula annotations, warnings for errors and empty cells.
Professional spreadsheets need clear structure, correct formulas, and intentional formatting.
Use Formulas, Not Hardcoded Values (MANDATORY)
This is the single most important principle. The spreadsheet must remain dynamic -- when source data changes, formulas recalculate automatically. Hardcoded values break this contract.
# WRONG -- hardcoded calculation result
officecli set data.xlsx "/Sheet1/B10" --prop value=5000
# CORRECT -- let Excel calculate
officecli set data.xlsx "/Sheet1/B10" --prop formula="SUM(B2:B9)"
Financial Model Color Coding
Convention
Color
Use For
Blue text
font.color=0000FF
Hardcoded inputs, scenario-variable numbers
Black text
font.color=000000
ALL formulas and calculations
Green text
font.color=008000
Cross-sheet links within same workbook
Red text
font.color=FF0000
External references
Yellow background
fill=FFFF00
Key assumptions needing attention
These are industry-standard financial modeling conventions. Apply when building financial models. For non-financial workbooks, use project-appropriate styling.
Shell quoting: Number formats containing $ must use single quotes ('$#,##0') or heredoc in batch mode. Double quotes cause shell variable expansion.
Column Width and Row Height
# Set column width (character units, ~1 char = 7px)
officecli set data.xlsx "/Sheet1/col[A]" --prop width=15
officecli set data.xlsx "/Sheet1/col[B]" --prop width=12
# Set row height (points)
officecli set data.xlsx "/Sheet1/row[1]" --prop height=20
# Hide column/row
officecli set data.xlsx "/Sheet1/col[D]" --prop hidden=true
officecli set data.xlsx "/Sheet1/row[5]" --prop hidden=true
There is no auto-fit. Set column widths explicitly. Common widths: labels=20-25, numbers=12-15, dates=12, short codes=8-10.
Freeze Panes
# Freeze first row (headers)
officecli set data.xlsx "/Sheet1" --prop freeze=A2
# Freeze first column and first row
officecli set data.xlsx "/Sheet1" --prop freeze=B2
Print Area
# Set print area on a sheet
officecli set data.xlsx "/Sheet1" --prop printArea="A1:F20"
Always add data validation on input cells in financial models and trackers. It prevents data entry errors.
Print Area and Page Setup
For print-ready workbooks, set appropriate column widths and row heights. Consider which sheets need headers repeated on each page.
QA (Required)
Assume there are problems. Your job is to find them.
Your first spreadsheet build is almost never correct. Approach QA as a bug hunt, not a confirmation step. If you found zero issues on first inspection, you were not looking hard enough.
Content QA
# Extract text, check for missing data
officecli view data.xlsx text
# Check structure
officecli view data.xlsx outline
# Check for issues (broken formulas, missing refs, empty sheets)
officecli view data.xlsx issues
# Verify formulas exist where expected
officecli query data.xlsx 'cell:has(formula)'
# Check for formula errors in cell values
officecli query data.xlsx 'cell:contains("#REF!")'
officecli query data.xlsx 'cell:contains("#DIV/0!")'
officecli query data.xlsx 'cell:contains("#VALUE!")'
officecli query data.xlsx 'cell:contains("#NAME?")'
officecli query data.xlsx 'cell:contains("#N/A")'
When editing templates, check for leftover placeholders:
Test 2-3 sample cell references: verify they pull correct values
Column mapping: confirm cell references point to intended columns
Row offsets: check formula ranges include all data rows
Division by zero: verify denominators are non-zero or wrapped in IFERROR
Cross-sheet references: use correct Sheet1!A1 format
Cross-sheet formula escaping: run officecli get on 2-3 cross-sheet formula cells and confirm no \! in the formula string. If \! is present, the formula is broken -- delete and re-set using batch/heredoc.
Named ranges: verify ref values match actual data locations
Edge cases: test with zero values, negative numbers, empty cells
Chart data vs formula results: for every chart with hardcoded/inline data, verify each data point matches the corresponding formula cell result. Use officecli get on the source cells and compare against chart series values. Mismatches here are silent data integrity bugs.
Validation
officecli validate data.xlsx
Pre-Delivery Checklist
Metadata set (title, author)
All formula cells contain formulas (not hardcoded values)
No formula error values (#REF!, #DIV/0!, #VALUE!, #NAME?, #N/A)
Number formats applied (currency, percentage, dates)
Column widths set explicitly (no default 8.43)
Header row styled (bold, fill, freeze panes)
Data validation on input cells
Charts have titles and readable axis labels
Chart data matches source cells -- charts with hardcoded/inline data can drift from formula results. For each chart, verify every data point against the corresponding cell value. Prefer cell-range references (series1.values="Sheet1!B2:B6") over inline data to avoid transcription errors.
Named ranges defined for key assumptions
Document validates with officecli validate
No placeholder text remaining
Comments on hardcoded assumption values documenting their source
NOTE: Unlike pptx (SVG/HTML), xlsx has no visual preview mode. Verification relies on view text, view annotated, view stats, view issues, validate, and formula queries. For visual verification, the user must open the file in Excel.
Verification Loop
Generate workbook
Run view issues + view annotated (sample ranges) + validate
Run formula error queries (all 5 error types)
List issues found (if none found, look again more critically)
Fix issues
Re-verify affected areas -- one fix often creates another problem
Repeat until a full pass reveals no new issues
Do not declare success until you have completed at least one fix-and-verify cycle.
Common Pitfalls
Pitfall
Correct Approach
--name "foo"
Use --prop name="foo" -- all attributes go through --prop
Guessing property names
Run officecli xlsx set cell to see exact names
\n in shell strings
Use \\n for newlines in --prop text="line1\\nline2"
OfficeCLI strips the = -- use formula="SUM(A1:A10)" not formula="=SUM(A1:A10)"
Cross-sheet ! in formulas
CRITICAL: The ! in Sheet1!A1 can be corrupted by shell quoting. Use batch/heredoc for cross-sheet formulas, or double quotes: --prop "formula==Sheet1!A1". NEVER use single quotes for formulas containing !. After setting, verify with officecli get that the formula shows Sheet1!A1 (no backslash before !).
Hardcoded calculated values
Use --prop formula="SUM(B2:B9)" not --prop value=5000
Shell interprets $ -- use single quotes: numFmt='$#,##0'
Year displayed as "2,026"
Set cell type to string: --prop type=string or use numFmt="@"
Performance: Resident Mode
Always use open/close — it is the smart default, not a special-case optimization. Every command benefits: no repeated file I/O, no repeated parse/serialize cycles.
officecli open data.xlsx # Load once into memory
officecli add data.xlsx ... # All commands run in memory — fast
officecli set data.xlsx ...
officecli close data.xlsx # Write once to disk
Use this pattern for every workbook build, regardless of command count.
parent = container to add into (for add). path = element to modify (for set, get, remove, move, swap).
Batch mode executes multiple operations in a single open/save cycle.
Known Issues
Issue
Workaround
Chart series cannot be added after creation
set --prop data= and set --prop seriesN= on an existing chart can only update existing series. To add series, delete and recreate: officecli remove data.xlsx "/Sheet1/chart[1]" then officecli add with all series.
No visual preview
Unlike pptx (SVG/HTML), xlsx has no built-in rendering. Use view text/view annotated/view stats/view issues for verification. Users must open in Excel for visual check.
Formula cached values for new formulas
OfficeCLI writes formula strings natively. For newly added formulas, the cached value may not update until the file is opened in Excel/LibreOffice. Existing formula cached values are preserved.
No auto-fit column width
No "auto-fit" column width based on content. Set width explicitly on each column.
Shell quoting in batch with echo
echo '...' | officecli batch fails when JSON values contain apostrophes or $. Use heredoc: cat <<'EOF' | officecli batch data.xlsx.
Batch intermittent failure
Batch+resident mode has a high failure rate (up to 1-in-3 in some sessions). For maximum reliability: (1) prefer batch WITHOUT resident mode, (2) keep batches to 8-12 operations, (3) always check batch output for failures, (4) retry failed operations individually. For critical formulas (especially cross-sheet), consider using individual set commands which have 100% reliability.
Data bar default min/max invalid
Creating a data bar without --prop min=N --prop max=N produces empty val attributes in cfvo elements, which may be rejected by strict XML validators or Excel. Always specify explicit min and max values.
Cell protection requires sheet protection
locked and formulahidden properties only take effect when the sheet itself is protected.
Help System
When unsure about property names, value formats, or command syntax, run help instead of guessing. One help query is faster than guess-fail-retry loops.
officecli xlsx set # All settable elements and their properties
officecli xlsx set cell # Cell properties in detail
officecli xlsx set cell.font # Specific property format and examples
officecli xlsx add # All addable element types
officecli xlsx view # All view modes
officecli xlsx get # All navigable paths
officecli xlsx query # Query selector syntax