---
id: gh-xlsx-author
name: "xlsx-author"
url: https://skills.yangsir.net/skill/gh-xlsx-author
author: anthropics
domain: data-analysis
tags: ["xlsx", "openpyxl", "excel", "report-generation", "headless"]
install_count: 1400
rating: 4.30 (120 reviews)
github: https://github.com/anthropics/financial-services/tree/main/plugins/agent-plugins/earnings-reviewer/skills/xlsx-author
---

# xlsx-author

> 此技能可在无 Office 应用的托管代理会话中直接生成 .xlsx 文件，用于交付财务模型、报表或数据工作簿。它通过 Python 脚本与 openpyxl 构建工作簿，遵循蓝/黑/绿的配色约定来区分输入、公式和链接，并提供平衡检查以保证数据一致性，使输出规范、可靠且易于交付。

**Stats**: 1,400 installs · 4.3/5 (120 reviews)

## Before / After 对比

### 在无 Excel 应用中生成 .xlsx 文件的耗时与合规性提升

**Before**:

在没有这个技能之前，在无 Office 应用中，用户需要编写大量底层代码来创建 Excel 文件，并手动检查公式与样式，过程繁琐且容易出错，交付一份模型往往需要数小时。

**After**:

此技能通过 openpyxl 脚本快速构建工作簿，自动遵循蓝/黑/绿配色约定，并内置平衡检查，用户只需编写少量代码即可在数分钟内得到合规文件。

| Metric | Before | After | Change |
|---|---|---|---|
| 生成时间 | 120分钟 | 15分钟 | -88% |
| 格式错误率 | 30% | 5% | -83% |

## Readme

# xlsx-author

Use this skill when running **headless** (managed-agent / CMA mode) and you need to deliver an Excel workbook as a **file artifact** rather than editing a live workbook via `mcp__office__excel_*`.

## Output contract

- Write to `./out/<name>.xlsx`. Create `./out/` if it does not exist.
- Return the relative path in your final message so the orchestration layer can collect it.

## How to build the workbook

Write a short Python script and run it with Bash. Use `openpyxl`:

```python
from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill

wb = Workbook()
ws = wb.active; ws.title = "Inputs"
ws["B2"] = "Revenue"; ws["C2"] = 1_250_000_000
ws["C2"].font = Font(color="0000FF")           # blue = hardcoded input
calc = wb.create_sheet("DCF")
calc["C5"] = "=Inputs!C2*(1+Inputs!C3)"        # black = formula
wb.save("./out/model.xlsx")
```

## Conventions (mirror `audit-xls`)

- **Blue / black / green.** Blue = hardcoded input, black = formula, green = link to another sheet/file.
- **No hardcodes in calc cells.** Every calculation cell is a formula; every input lives on an Inputs tab.
- **Named ranges** for any value referenced from a deck or memo.
- **Balance checks.** Include a Checks tab that ties (BS balances, CF ties to cash, etc.) and surfaces TRUE/FALSE.
- **One model per file.** Do not append to an existing workbook unless explicitly asked.

## When NOT to use

If `mcp__office__excel_*` tools are available (Cowork plugin mode), use those instead — they drive the user's live workbook with review checkpoints. This skill is the file-producing fallback for headless runs.


---
*Source: https://skills.yangsir.net/skill/gh-xlsx-author*
*Markdown mirror: https://skills.yangsir.net/api/skill/gh-xlsx-author/markdown*