Tooluck logoTooluck
SKILL.md

office-file-process

Agent skill fromxstongxue/best-skills

处理 Office 文档的一站式 skill:Word(.doc/.docx/.dotx)、Excel(.xls/.xlsx/.xlsm/.csv)、PowerPoint(.ppt/.pptx/.potx) 的创建、读取、编辑、提取、转换、校验。触发:『读取 word 文档』『提取 excel 内容』『看 ppt 讲了什么』、.doc 老格式打不开、生成/编辑 Word 报告/合同/模板、制作幻灯片/deck/演示文稿、写带公式的电子表格。读取优先 pandoc/markitdown 等官方工具,环境没有则走 Windows Office COM 自动化(含中文文件名、PowerShell 编码等 Windows 环境方案);创建/编辑用 docx-js、pptxgenjs、openpyxl 等。Use whenever any .docx/.xlsx/.pptx file is the primary input or output: create, read, edit, extract, convert, or validate it.

How to install office-file-process

install office-file-process
# install the best-skills pack with the skills CLI
npx skills add xstongxue/best-skills

# or add only this skill to Claude Code: copy the folder

skills/office-file-process/

# into

~/.claude/skills/office-file-process/ (all projects)

.claude/skills/office-file-process/ (one project)

skills/office-file-process/SKILL.md

Apache-2.0Full file
1# Office 文档处理(统一入口)
2
3处理 Word / Excel / PowerPoint 文件的统一 skill。面向 **Windows + Office** 环境(COM 自动化是它独有的兜底能力),不预设任何机器装了哪些工具——**动手前先探测环境**,再按本文规则决策。非 Windows 或无 Office 的机器见文末降级方案。**先按任务路由**,细节在对应参考文档里。
4
5## 任务路由
6
7| 任务 | 路线 | 详情 |
8|---|---|---|
9| **读取/提取**任何 Office 文档内容 | 按下方"读取路线怎么选"决策 | 本页 |
10| **创建/编辑** Word 文档 | docx-js(新建)/ unzip+XML(编辑) | [reference/docx.md](reference/docx.md) |
11| **创建/编辑** PowerPoint | pptxgenjs(新建)/ unzip+XML(编辑) | [reference/pptx.md](reference/pptx.md) |
12| **创建/编辑** Excel | openpyxl / pandas | [reference/xlsx.md](reference/xlsx.md) |
13| **校验** docx/pptx/xlsx 输出 | `scripts/office/validate.py` | 各格式参考文档的 QA 节 |
14
15## 读取路线怎么选(官方工具 vs Office COM)
16
17**原则:有环境就用官方的(输出质量更高),没有就用 COM 提取脚本。** 先探测环境再动手:
18
19```bash
20where pandoc 2>/dev/null && echo HAS_PANDOC
21python -c "import markitdown" 2>/dev/null && echo HAS_MARKITDOWN
22python -c "import openpyxl" 2>/dev/null && echo HAS_OPENPYXL
23```
24
25| 格式 | 环境在(优先) | 环境不在(退回 COM) |
26|---|---|---|
27| .docx | `pandoc -t markdown file.docx` — 输出带结构 markdown(标题层级、列表、表格),后续处理质量最高 | `extract_office_text.ps1` — 纯文本,表格转制表符 |
28| .pptx | `markitdown deck.pptx` — 每页一块带 `<!-- Slide number: N -->` 标记 | `extract_office_text.ps1` — 逐页文本 + `[NOTES]` 备注 |
29| .xlsx | `markitdown file.xlsx` 快速浏览;`openpyxl`/`pandas` 精确读(有单元格坐标,规划编辑必须用它) | `extract_office_text.ps1` — 逐 sheet 制表符纯文本,无坐标 |
30| .doc/.xls/.ppt(老格式) | 官方工具也读不了(二进制) | **COM 是唯一路径**(或 COM 转新格式后再走官方工具) |
31
32补充判断:
33…

Excerpt shown under the repository's Apache-2.0 license.

More skills in best-skills

Keep exploring

Similar skill repositories

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates