---
name: Office Xlsx Expert
slug: office-xlsx-expert
category: Automation
description: Office Xlsx Expert creates and formats Excel workbooks with openpyxl. Use it for styled headers, zebra striping, freeze panes, data validation, conditional formatting, formulas, and column sizing.
github: "https://github.com/val1813/kwcode/tree/master/kaiwu/builtin_experts/office_xlsx"
language: Python
stars: 688
forks: 92
install: "npx degit https://github.com/val1813/kwcode/tree/master/kaiwu/builtin_experts/office_xlsx ~/.claude/skills/office_xlsx"
installs_to: ~/.claude/skills/office_xlsx
source_path: kaiwu/builtin_experts/office_xlsx/SKILL.md
collection_size: 19
category_size: 1523
collection_url: "https://dirskills.com/collections/val1813/kwcode"
added: 2026-08-12T04:43:49.978Z
last_synced: 2026-08-12T04:43:49.978Z
canonical_url: "https://dirskills.com/skills/office-xlsx-expert"
---

# Office Xlsx Expert

Office Xlsx Expert creates and formats Excel workbooks with openpyxl. Use it for styled headers, zebra striping, freeze panes, data validation, conditional formatting, formulas, and column sizing.

**Install:**

```bash
npx degit https://github.com/val1813/kwcode/tree/master/kaiwu/builtin_experts/office_xlsx ~/.claude/skills/office_xlsx
```

## README

## 领域知识

- 使用openpyxl库，Workbook()创建，ws = wb.active获取活动sheet
- 表头样式：深色背景（#003366）+白色加粗字体+居中对齐
- 斑马纹：奇偶行交替浅灰（#F2F2F2）和白色背景
- 冻结首行：ws.freeze_panes = 'A2'，冻结首行+首列用'B2'
- 列宽自适应：遍历列取max(len(str(cell.value)))设置column_dimensions
- 数据验证：DataValidation(type="list", formula1='"选项1,选项2"')
- 条件格式：ColorScaleRule/CellIsRule高亮异常值
- 公式：直接写Excel公式字符串如'=SUM(B2:B100)'，不用Python计算
- 数字格式：金额'#,##0.00'，百分比'0.00%'，日期'YYYY-MM-DD'
- 合并单元格：ws.merge_cells('A1:D1') 用于标题行
- 边框：thin边框包围数据区域，表头用medium底边框

## 经验规则（自动生成）
