← 返回 Skills 市场
mohamed-hammane

Excel Export

作者 Umbra · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ 安全检测通过
131
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install excel-export
功能描述
Generate polished .xlsx workbooks from structured JSON — multiple sheets, frozen headers, filters, typed columns, formulas, totals, and French/Morocco format...
使用说明 (SKILL.md)

When to Use

Use when the agent must deliver a .xlsx Excel file — sales reports, query results, multi-sheet data exports, financial summaries, or any structured data that needs polished spreadsheet formatting. This skill handles workbook creation only. Do not use it to read, edit, or preserve existing Excel files.

Setup

python3 -m venv ~/.openclaw/workspace/.venv_excel
~/.openclaw/workspace/.venv_excel/bin/pip install xlsxwriter

No credentials required.

How to Run

~/.openclaw/workspace/.venv_excel/bin/python skills/excel-export/scripts/build_xlsx.py \
  --input  \x3Cpath/to/workbook.json> \
  --output \x3Cpath/to/report.xlsx>

Default export directory: ~/.openclaw/workspace/exports/excel/.

The script prints a JSON summary to stdout on success:

{
  "success": true,
  "output": "/absolute/path/to/report.xlsx",
  "sheets": [
    { "sheet": "Ventes", "rows": 42 },
    { "sheet": "Charges", "rows": 18 }
  ]
}

Input Format

The input is a single JSON file. Top-level shape:

{
  "sheets": [ ... ]
}

Each sheet object:

Field Required Description
name yes Sheet tab name (max 31 chars)
title no Bold title row above the table
subtitle no Muted subtitle row below the title
columns yes Array of column definitions
rows no Array of data objects (keyed by key)

Each column object:

Field Required Description
key yes Row-object key for this column's values
header yes Display header in the table
type no Data type (default text) — see table below
width no Explicit column width (overrides auto-estimate)
numfmt no Custom Excel number format (overrides type default)
formula no Excel table structured-reference formula
total no Totals-row function: sum, average, or count

Rows are objects keyed by column key, not positional arrays. Missing keys produce blank cells. Unknown keys cause a validation error.

Column Types

Type Default format Notes
text Always stored as text
integer #,##0 Rounded to whole number
number #,##0.00 Two decimal places
percent 0.0% Pass 0.15 for 15 %
currency #,##0.00 "MAD" Moroccan dirham by default
date dd/mm/yyyy Accepts YYYY-MM-DD strings
datetime dd/mm/yyyy hh:mm Accepts ISO 8601 strings
boolean Rendered as Oui / Non

Use numfmt on any column to override its type's default format.

Rendering Rules

Layout — fixed, deterministic, never configured per-sheet:

  • No title/subtitle → table header on row 1.
  • Title only → title row 1, blank row 2, table header row 3.
  • Title + subtitle → title row 1, subtitle row 2, blank row 3, table header row 4.

Freeze pane — always at the first data row (A2, A4, or A5 depending on title presence).

Table style — each sheet is one rectangular Excel table with filters, banded rows, and Table Style Medium 9.

Column widths — auto-estimated from headers and sampled values, capped at 50 characters. Explicit width in the column definition overrides the estimate.

Formulas — use Excel structured references (e.g. =[@Revenue]/SUM([Revenue])). Formula columns are injected through the table definition, not written cell-by-cell, so they apply to every data row automatically.

Totals row — if any column has total, the table includes a totals row. The first column displays "Total" as a label unless it has its own total function.

Empty datasets — produce a valid workbook with headers, filters, styling, and zero data rows.

Data-Integrity Doctrine

These rules are always enforced — they are not optional:

  1. Preserve data types. Leading-zero strings, phone numbers (+212…), and numeric strings longer than 15 digits are always stored as text. Excel silently corrupts these if written as numbers.

  2. Keep calculations in Excel. When the workbook should stay live, write formulas — not hardcoded derived values from Python. Use structured references so formulas survive row insertions and deletions.

  3. Treat dates explicitly. Dates are serial numbers with legacy quirks. The script writes real date objects with explicit dd/mm/yyyy formatting — never raw serial numbers or ambiguous strings.

  4. Validate before delivery. The script validates every input field, rejects unknown keys, and fails fast with clear error messages. A workbook should never ship with silent data loss.

  5. Regional defaults are French / Morocco. Date format dd/mm/yyyy, currency MAD, booleans Oui / Non. Note: final display still depends partly on the viewer's local Excel regional settings.

Full Example

{
  "sheets": [
    {
      "name": "Ventes Q1",
      "title": "Rapport des Ventes — Q1 2026",
      "subtitle": "Direction Commerciale",
      "columns": [
        { "key": "region",  "header": "Région",     "type": "text" },
        { "key": "ca",      "header": "CA (MAD)",   "type": "currency", "total": "sum" },
        { "key": "volume",  "header": "Volume",     "type": "integer",  "total": "sum" },
        { "key": "growth",  "header": "Croissance", "type": "percent" },
        { "key": "date",    "header": "Date",       "type": "date" },
        { "key": "active",  "header": "Actif",      "type": "boolean" }
      ],
      "rows": [
        { "region": "Casablanca", "ca": 1250000, "volume": 340, "growth": 0.15, "date": "2026-03-31", "active": true },
        { "region": "Rabat",      "ca": 980000,  "volume": 210, "growth": -0.03, "date": "2026-03-31", "active": true },
        { "region": "Tanger",     "ca": 670000,  "volume": 155, "growth": 0.08,  "date": "2026-03-31", "active": false }
      ]
    }
  ]
}
~/.openclaw/workspace/.venv_excel/bin/python skills/excel-export/scripts/build_xlsx.py \
  --input  ~/.openclaw/workspace/exports/ventes_q1.json \
  --output ~/.openclaw/workspace/exports/excel/ventes_q1.xlsx

Validation Rules

The script fails fast with a clear error on:

  • Invalid or missing JSON
  • Duplicate sheet names
  • Sheet names exceeding 31 characters, containing [ ] : * ? / \, or starting/ending with apostrophes
  • subtitle without title
  • Row count above 1,048,576 or column count above 16,384
  • Unknown keys in row objects
  • Invalid type or total values
  • Non-string formula definitions
  • Unrecognized boolean values (only true/false, 1/0, yes/no, oui/non accepted)
  • Non-integer values in integer columns (e.g. 12.9 is rejected, not truncated)
  • Unparseable dates, datetimes, or numeric strings in typed columns

SQL-Driven Exports

When generating Excel files from SQL query results, read references/SQL_TO_EXCEL_RECIPE.md for the standard pipeline: query with mssql, normalize values, build the JSON spec, then render. The recipe includes SQL-to-JSON type mappings, normalization rules, ready-made templates, and common mistakes.

Limitations (v1)

  • Creation only — does not read or edit existing workbooks.
  • No template preservation, merged cells, or conditional formatting.
  • One fixed visual theme — no configurable colour system.
  • No CSV input — upstream steps must produce JSON.
  • xlsxwriter does not calculate formulas; the recipient's Excel client recalculates on open.
安全使用建议
This skill appears coherent and limited to creating Excel workbooks from JSON. Before installing: (1) be comfortable running a local Python venv and installing xlsxwriter; (2) inspect scripts/build_xlsx.py (provided) yourself if you require extra assurance — the source is included; (3) note the venv and output paths (under ~/.openclaw/workspace) so you can control where files land; and (4) because the skill has no homepage and an unknown publisher, consider running it in an isolated environment (or review the code) if you need to be extra cautious.
功能分析
Type: OpenClaw Skill Name: excel-export Version: 1.1.0 The excel-export skill is a well-documented and robust tool for generating formatted Excel workbooks from JSON data. The core script, scripts/build_xlsx.py, implements extensive validation for Excel constraints and data types, including specific logic to prevent data loss for long numeric strings and leading zeros. The skill lacks any indicators of malicious intent, such as unauthorized network access, data exfiltration, or suspicious execution patterns, and focuses entirely on its stated purpose of spreadsheet generation with regional defaults for Morocco.
能力评估
Purpose & Capability
Name/description promise (render polished Excel files from JSON) matches the included Python script and SKILL.md. The only required binary is python3 and the SKILL.md asks to install the xlsxwriter Python package — both are directly relevant.
Instruction Scope
SKILL.md contains focused runtime instructions: create a venv, pip install xlsxwriter, and run scripts/build_xlsx.py with --input/--output. The instructions do not request reading unrelated system files, credentials, or sending data to external endpoints. The recipe document references an optional SQL → JSON pipeline, which is guidance not a hidden dependency.
Install Mechanism
There is no registry install spec; SKILL.md recommends creating a local venv and pip installing xlsxwriter from PyPI. This is a standard, low-risk approach (no arbitrary URL downloads or archive extraction).
Credentials
The skill declares no environment variables, credentials, or config path requirements. Nothing in the code or docs asks for unrelated secrets or external tokens.
Persistence & Privilege
The skill is not always-enabled and does not request elevated platform privileges. It creates a local venv under ~/.openclaw/workspace which is reasonable for a Python-based tool and does not modify other skills or system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install excel-export
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /excel-export 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
Strict validation: sheet names fail fast (no silent correction, case-insensitive duplicate check), boolean parsing accepts only true/false/1/0/yes/no/oui/non, integer columns reject non-whole values like 12.9, subtitle requires title. Added SQL-to-Excel recipe in references/.
v1.0.1
Added SQL-to-Excel recipe in references/, tightened type validation (fail-fast on invalid typed values, reject booleans in numeric columns, reject subtitle without title), guard 16+ digit numeric IDs from precision loss.
v1.0.0
Initial release — write-only .xlsx generation from JSON with French defaults, typed columns, formulas, totals, and data-integrity guards.
元数据
Slug excel-export
版本 1.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Excel Export 是什么?

Generate polished .xlsx workbooks from structured JSON — multiple sheets, frozen headers, filters, typed columns, formulas, totals, and French/Morocco format... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 131 次。

如何安装 Excel Export?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install excel-export」即可一键安装,无需额外配置。

Excel Export 是免费的吗?

是的,Excel Export 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Excel Export 支持哪些平台?

Excel Export 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Excel Export?

由 Umbra(@mohamed-hammane)开发并维护,当前版本 v1.1.0。

💬 留言讨论