Automates reading, writing, merging, transforming, and validating Excel (.xlsx/.xls) files. Use when the user works with spreadsheets, .xlsx files, Excel dat...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install automate-excel或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install automate-excel⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/automate-excel/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: automate-excel description: Automates reading, writing, merging, transforming, and validating Excel (.xlsx/.xls) files. Use when the user works with spreadsheets, .xlsx files, Excel data, CSV-to-Excel conversion, batch Excel processing, or report generation from tables. ---
在用户需要处理 Excel 文件、表格数据、批量转换或报表生成时应用本 skill。
| 你想做的事 | 调用的脚本 | 典型参数 | |------------|------------|----------| | 多个 Excel 或多个 sheet 合成一张表 | merge_sheets.py | --inputs 文件或目录 --output out.xlsx | | 把某 sheet 导出成 CSV | excel_to_csv.py | --input file.xlsx --output file.csv | | 把 CSV 转成 Excel | csv_to_excel.py | --input a.csv --output a.xlsx 或 --inputs a.csv b.csv | | 按条件筛选行(等于/大于/包含) | filter_excel.py | --where "列名=值" 或 "列名>100"、"列名~北京" | | 按行数拆成多个文件,或按某列取值拆分 | split_excel.py | --by-rows 5000 或 --by-column 地区 | | 按某列去重 | deduplicate_excel.py | --keys 编号 --keep first/last | | 按列分组并求和/计数/平均 | aggregate_excel.py | --group-by 地区 --agg "销售额:sum" | | 检查必须列、重复键、空行 | validate_excel.py | --require-cols 列名 --key-cols 列名 | | 只保留/重命名部分列 | select_columns.py | --columns 列1,列2 --rename "旧:新" | | 两个表按一列对齐合并(VLOOKUP) | merge_tables.py | --left a.xlsx --right b.xlsx --on 键列 | | 主表依次跟多个表做 VLOOKUP | vlookup_multi.py | --main 主.xlsx --lookups "表1.xlsx:键列" "表2.xlsx:键列" | | 行列转置 | transpose_excel.py | --input in.xlsx --output out.xlsx | | 用数据表按行填模板里的 {{列名}} | template_fill.py | --template t.xlsx --data d.csv --output out.xlsx | | 重命名工作表 | rename_sheets.py | --rename "Sheet1:新名" 或 --prefix "2024_" | | 条件格式(大于/小于/重复值/色阶) | format_conditional.py | --column C --rule gt --value 100 --fill red | | 某列当文本显示,避免科学计数法 | format_columns_as_text.py | --columns 身份证号,订单号 |
本地直接运行:进入本 skill 所在目录(或把 scripts/ 加入路径),先 pip install -r scripts/requirements.txt,再执行 python scripts/脚本名.py --help 看参数,或按上表传参运行。
openpyxl(保留格式、公式、多工作表)pandas + openpyxl 引擎xlrd(只读)优先用 openpyxl 做单元格级操作和格式保留;需要筛选、聚合、合并多表时用 pandas。
pip install openpyxl pandas xlrd
或使用 skill 自带:pip install -r scripts/requirements.txt
整表为 list of dict(保留表头):
import openpyxl
wb = openpyxl.load_workbook("input.xlsx", read_only=True, data_only=True)
ws = wb.active # 或 wb["Sheet1"]
rows = list(ws.iter_rows(min_row=1, values_only=True))
header = rows[0]
data = [dict(zip(header, row)) for row in rows[1:]]
wb.close()
用 pandas(适合分析、过滤、合并):
import pandas as pd
df = pd.read_excel("input.xlsx", sheet_name=0, engine="openpyxl")
# sheet_name 可为 0、"Sheet1" 或 [0, 1] 多表
指定区域:
# openpyxl
for row in ws["A1:D10"]:
...
# pandas
df = pd.read_excel("input.xlsx", usecols="A:D", header=0, nrows=100)
新建并写入(openpyxl):
from openpyxl import Workbook
from openpyxl.styles import Font, Alignment
wb = Workbook()
ws = wb.active
ws.title = "结果"
ws.append(["列A", "列B", "列C"])
for row in data_rows:
ws.append(row)
ws["A1"].font = Font(bold=True)
wb.save("output.xlsx")
用 pandas 写出多表:
with pd.ExcelWriter("output.xlsx", engine="openpyxl") as writer:
df1.to_excel(writer, sheet_name="汇总", index=False)
df2.to_excel(writer, sheet_name="明细", index=False)
追加到已有文件(先加载再写):
wb = openpyxl.load_workbook("existing.xlsx")
ws = wb["Sheet1"]
for row in new_rows:
ws.append(row)
wb.save("existing.xlsx")
| 任务 | 做法 | |----------------|------| | 多文件合并 | merge_sheets.py 或 pandas read_excel + pd.concat + to_excel。 | | CSV ↔ Excel | excel_to_csv.py / csv_to_excel.py 或 pandas 读写。 | | 按条件筛选 | filter_excel.py 或 df[df["列"] == 值] / df.query()。 | | 按行/按列拆分 | split_excel.py(按行数或按某列取值分文件)。 | | 去重 | deduplicate_excel.py 或 df.drop_duplicates(subset=["列"], keep="first")。 | | 按列聚合 | aggregate_excel.py 或 df.groupby("列").agg({"数值列": "sum"})。 | | 校验 | validate_excel.py。 | | 选择/重命名列 | select_columns.py。 | | 两表按键合并 | merge_tables.py(left/inner/outer)。 | | 行列转置 | transpose_excel.py。 | | 模板填充 | template_fill.py({{列名}} 占位符)。 | | 重命名 sheet | rename_sheets.py。 | | 多表 VLOOKUP | vlookup_multi.py(主表 + 多个查找表依次左连接)。 | | 条件格式 | format_conditional.py(大于/小于/介于/重复值/色阶)。 | | 列格式为文本 | format_columns_as_text.py(避免长数字科学计数法)。 | | 保留原格式写数据 | 用 openpyxl 加载原文件,只改写目标单元格,再 save。 |
当用户需要处理目录下多个 Excel 时:
pathlib.Path("目录").glob("*.xlsx") 枚举文件。原名_out.xlsx 等约定;在 SKILL 中明确输出命名规则。Path(file).exists() 检查文件存在。write_only=True 或分块。openpyxl.utils.exceptions.InvalidFileException、KeyError(工作表名)等并返回可读错误信息。skill 目录下 scripts/ 提供可执行脚本,优先在用户环境中运行脚本而非临时写长代码。
| 脚本 | 功能 | |------|------| | merge_sheets.py | 多 Excel 或同文件多 sheet 合并为一张表 | | excel_to_csv.py | 指定 sheet 导出为 CSV | | csv_to_excel.py | CSV 转 Excel(单/多 CSV → 多 sheet) | | filter_excel.py | 按列条件筛选(=、>、<、~ 包含)输出 Excel/CSV | | split_excel.py | 按行数分片或按某列取值拆成多个文件 | | deduplicate_excel.py | 按指定列去重,保留 first/last | | aggregate_excel.py | 按列分组聚合(sum/count/mean/min/max) | | validate_excel.py | 校验必须列、重复键、空行 | | select_columns.py | 选择/重命名/排序列 | | merge_tables.py | 两表按键列合并(VLOOKUP 式,left/inner/outer) | | transpose_excel.py | 行列转置 | | template_fill.py | 用数据表按行填充模板中的 {{列名}} 占位符 | | rename_sheets.py | 重命名工作表(原名:新名、索引:新名、前缀/后缀) | | vlookup_multi.py | 多表 VLOOKUP:主表依次与多个查找表左连接 | | format_conditional.py | 按条件格式化(gt/lt/介于/重复值/色阶) | | format_columns_as_text.py | 将指定列设为文本格式,避免纯数字显示为科学计数法 |
用法见各脚本 --help 或 reference.md。
安装 Automate Excel 后,可以对 AI 说这些话来触发它
Help me get started with Automate Excel
Explains what Automate Excel does, walks through the setup, and runs a quick demo based on your current project
Use Automate Excel to automates reading, writing, merging, transforming, and validating E...
Invokes Automate Excel with the right parameters and returns the result directly in the conversation
What can I do with Automate Excel in my documents & notes workflow?
Lists the top use cases for Automate Excel, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/automate-excel/ 目录(个人级,所有项目可用),或 .claude/skills/automate-excel/(项目级)。重启 AI 客户端后,用 /automate-excel 主动调用,或让 AI 根据上下文自动发现并使用。
Automate Excel 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Automate Excel 可免费安装使用。请查阅仓库了解许可证信息。
Automates reading, writing, merging, transforming, and validating Excel (.xlsx/.xls) files. Use when the user works with spreadsheets, .xlsx files, Excel dat...
Automate Excel 属于「Documents & Notes」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my documents & notes tasks using Automate Excel
Identifies repetitive steps in your workflow and sets up Automate Excel to handle them automatically