Install
openclaw skills install minimax-xlsxMiniMax spreadsheet production system. Engage for any task that involves tabular data, numeric analysis, or spreadsheet generation. Supports XLSX/XLSM/CSV through Python 3 (openpyxl + pandas) for workbook construction, formula recalculation via recalc.py (LibreOffice headless), and the MiniMaxXlsx CLI (C#/.NET) for structural validation, formula auditing, and pivot table synthesis.
openclaw skills install minimax-xlsx<toolkit_inventory>
Workbook construction — Python 3 via the ipython tool: openpyxl (creation, styling, formulas) + pandas (data wrangling).
Formula recalculation — recalc.py via the shell tool: invokes LibreOffice in headless mode to compute all formula values, then scans for error tokens and returns a JSON report. openpyxl writes formula text (e.g., =SUM(A1:A10)) but does NOT compute results — this script fills that gap.
python ./scripts/recalc.py output.xlsx [timeout_seconds]
wb.save() and BEFORE recalc, whenever the file has formulasClean output:
{"status": "success", "total_errors": 0, "total_formulas": 42, "error_summary": {}}
Error output:
{"status": "errors_found", "total_errors": 2, "total_formulas": 42, "error_summary": {"#REF!": {"count": 2, "locations": ["Sheet1!B5", "Sheet1!C10"]}}}
CLI diagnostics — MiniMaxXlsx binary via the shell tool, located at ./scripts/MiniMaxXlsx:
| Command | What it does | Typical invocation |
|---|---|---|
recalc | Detects formula error tokens (#VALUE!, #REF!, etc.), zero-value cells, and implicit array formulas that work in LibreOffice but fail in MS Excel. Run after recalc.py. | ./scripts/MiniMaxXlsx recalc output.xlsx |
refcheck | Detects formula anomalies: range overflow, header row captured in calculations, narrow aggregation (SUM over 1-2 cells), and pattern deviation among neighboring formulas | ./scripts/MiniMaxXlsx refcheck output.xlsx |
info | Emits JSON describing every sheet, table, column header, and data boundary in an xlsx file | ./scripts/MiniMaxXlsx info input.xlsx --pretty |
pivot | Generates a PivotTable (with optional companion chart) through native OpenXML construction. Read ./pivot.md before use. Required flags: --source, --location, --values. Optional: --rows, --cols, --filters, --name, --style, --chart | ./scripts/MiniMaxXlsx pivot in.xlsx out.xlsx --source "Sheet!A1:F100" --rows "Col" --values "Val:sum" --location "Dest!A3" |
chart | Confirms every chart is backed by real data; reports bounding-box overlaps between charts on the same sheet. Exit 0 = OK; exit 1 = broken/empty charts that must be fixed. Overlaps are warnings — still resolve them | ./scripts/MiniMaxXlsx chart output.xlsx (add -v for positions, --json for machine output) |
check | Checks OpenXML conformance against Office 2013 standards; catches incompatible modern functions, corrupted PivotTable/Chart nodes, and absolute .rels paths. Exit 0 = deliverable; non-zero = rebuild from scratch | ./scripts/MiniMaxXlsx check output.xlsx |
Implicit array formula handling (detected by recalc):
MATCH(TRUE(), range>0, 0) require CSE (Ctrl+Shift+Enter) in MS Excel=MATCH(TRUE(), A1:A10>0, 0) → shows #N/A in Excel=SUMPRODUCT((A1:A10>0)*ROW(A1:A10))-ROW(A1)+1 → works everywhereSupplementary guides (loaded on demand — not preloaded):
./pivot.md — mandatory before any PivotTable work./charts.md — mandatory before creating chart objects./styling.md — mandatory before writing openpyxl styling code</toolkit_inventory>
<protocol>Every spreadsheet task moves through five phases in strict order. Do not skip or reorder phases.
<phase_intake>
Before writing any code:
External data provenance — if the deliverable incorporates data fetched via datasource, web_search, API calls, or any retrieval tool:
Provider | Reference Link| Data Content | Provider | Reference Link |
|---|---|---|
| Apple Revenue | Yahoo Finance | https://finance.yahoo.com/... |
| China GDP | World Bank API | world_bank_open_data |
</phase_intake>
<phase_design>
Create a sheet-level blueprint before writing any code. For each sheet, document:
Dynamic computation rule (non-negotiable):
Any value derivable from a formula must be expressed as a formula. Static values are only acceptable for external-fetch data, true constants, or circular-dependency avoidance.
# Live formulas — correct
ws['D3'] = '=B3*C3'
ws['E3'] = '=D3/SUM($D$3:$D$50)'
ws['F3'] = '=AVERAGE(B3:B50)'
# Frozen snapshots — wrong
result = price * qty
ws['D3'] = result # loses traceability
Cross-table lookups — step by step:
When two tables share a common key (signals: "based on", "from another table", "match against", or columns like ProductID / EmployeeID appear in both):
INDEX() + MATCH() insteadws['D3'] = '=IFERROR(VLOOKUP(B3,$E$2:$H$120,2,FALSE),"")'
Summary!$A$2:$D$80merge() for VLOOKUP is not allowedCommon pitfalls: #N/A usually means the key does not exist in the target range; #REF! means the column index exceeds the width of the lookup range.
Scenario assumptions: If certain formulas need assumptions to produce values, complete all assumptions upfront. Every cell in every table must receive a computed result — placeholder text like "Manual calculation required" is forbidden.
</phase_design>
<phase_fabrication>
Construct the workbook one sheet at a time. Audit immediately after each sheet — never defer checks to the end.
FOR EACH sheet:
1. BUILD — populate cells with data, formulas, and visual formatting
2. SAVE — wb.save('output.xlsx')
3. RECALC — python ./scripts/recalc.py output.xlsx (if sheet has formulas)
4. AUDIT — ./scripts/MiniMaxXlsx recalc output.xlsx
./scripts/MiniMaxXlsx refcheck output.xlsx
(if the sheet has charts) ./scripts/MiniMaxXlsx chart output.xlsx -v
5. FIX — resolve every finding; loop back to step 1 until zero issues
6. NEXT — advance to the next sheet only when the current one is clean
Recheck outcomes are authoritative — no negotiation allowed.
The recalc subcommand identifies formula errors (#VALUE!, #DIV/0!, #REF!, #NAME?, #N/A, etc.) and zero-result cells. Follow these rules without exception:
recalc flags ANY issue, resolve it before delivery. Period.error_count: 5 means 5 problems to solvezero_value_count: 3 means 3 suspicious cells to examineerror_count: 0 allows advancing to the next stepWorkbook scaffold:
from openpyxl import Workbook
from openpyxl.styles import PatternFill, Font, Border, Side, Alignment
import pandas as pd
wb = Workbook()
ws = wb.active
ws.title = "Data"
ws.sheet_view.showGridLines = False # mandatory on every sheet
ws['B2'] = "Title"
ws['B2'].font = Font(size=16, bold=True)
ws.row_dimensions[2].height = 30 # prevent title clipping
wb.save('output.xlsx')
Visual design — before writing any styling code, read ./styling.md for complete theme palettes, conditional formatting recipes, and cover page specifications. Key rules:
Merged cells: Use ws.merge_cells() for titles, multi-column headers, or grouped labels. Apply formatting to the top-left cell only. Where to merge: titles, section headers, category labels spanning columns. Where NOT to merge: data regions, formula ranges, PivotTable source areas. Always set alignment on merged cells.
Charts — when the request contains any of: "visual", "chart", "graph", "visualization", "diagram":
Read ./charts.md in full before creating any chart object. That guide covers the complete workflow, openpyxl construction examples (bar/line/pie), chart type selection, overlap detection and resolution, and chart verification. Do not attempt chart creation without it.
PivotTables — activate when you detect any of these signals:
When a PivotTable is warranted:
./pivot.md cover-to-cover before doing anythingpivot CLI command exclusively — hand-coding pivot structures in openpyxl is forbiddenload_workbook() call will silently break internal XML references, producing a file Excel refuses to openExecution order is strict: Complete all openpyxl-authored sheets (Cover, Summary, data tabs) first, then run pivot as the final write step. After pivot emits the file, do not modify that file again.
</phase_fabrication>
<phase_verification>
After every sheet has passed its individual audit, run the structural gate:
./scripts/MiniMaxXlsx check output.xlsx
</phase_verification>
<phase_release>
Before handing the file to the user, confirm every item:
pivot CLI, not hand-coded in openpyxlmerge()check returned exit code 0</phase_release>
</protocol> <guardrails>Zero-tolerance error tokens — none of these may exist in the delivered file:
#VALUE!, #DIV/0!, #REF!, #NAME?, #NULL!, #NUM!, #N/A
Additional banned outcomes:
= misinterpreted as a formulaOff-by-one prevention: Before each save, trace every formula's references back to the intended cells. Then run refcheck. Common errors: referencing header rows, wrong row/column offset. If a result is 0 or unexpected, verify references first.
Monetary values: Store at full precision (15000000, not 1.5M). Format for display via "¥#,##0". Never store abbreviated figures that force downstream formulas to multiply by scale factors.
Compatibility blocklist — the check command rejects these automatically:
The following functions require Excel 365/2021+ or are Google Sheets exclusives. Files that use them will fail to open in Excel 2019/2016. Grouped by migration effort:
Drop-in replacements available (swap the function, keep the same cell structure):
| Blocked | Substitute |
|---|---|
XLOOKUP() | INDEX() + MATCH() |
XMATCH() | MATCH() |
SORT(), SORTBY() | Sort via Data ribbon or VBA |
SEQUENCE() | ROW() arithmetic or manual fill |
RANDARRAY() | RAND() with fill-down |
LET() | Break into helper cells |
LAMBDA() | Named ranges or VBA |
Structural redesign required (no drop-in replacement — rethink the approach):
| Blocked | Migration strategy |
|---|---|
FILTER() | AutoFilter, or SUMIF/COUNTIF criteria ranges |
UNIQUE() | Remove Duplicates, or COUNTIF-based dedup helper column |
TEXTSPLIT() | MID() + FIND() chain |
VSTACK(), HSTACK() | Manual range layout or helper columns |
TAKE(), DROP() | INDEX() + ROW() offset slicing |
ARRAYFORMULA() (Google only) | CSE arrays via Ctrl+Shift+Enter |
QUERY() (Google only) | PivotTables or SUMIF/COUNTIF |
IMPORTRANGE() (Google only) | Copy data into the workbook manually |
Banned workflow patterns:
recalc / refcheck findings and moving to the next sheetcheck