Skip to content
alyn
XiaoMaColtAI

Excel工具 skill

读取、创建、修改和验证 XLSX,支持模板保留、公式重算和错误检查。

$npx skills add XiaoMaColtAI/math-modeling-skill --skill Excel工具
View this skill on GitHubXiaoMaColtAI/math-modeling-skill/tools/xlsx/SKILL.md
Pack stars
1,920
Pack installs
1.1k
Alyn Score
55/99
Updated
3 h ago
– views – installs via Alyn

XiaoMaColtAI

Excel工具

Install Excel工具

Pick your agent. Every command is ready to paste.

$npx skills add XiaoMaColtAI/math-modeling-skill --skill Excel工具

The open skills CLI detects your agents (Claude Code, Cursor, Codex and 70+ more) and installs to the right folder. Add -g to install globally.

01

Install it

Run the command above, or upload the folder in Claude.

02

Ask naturally

Describe the task. Your agent loads Excel工具 when the request matches its description.

03

Name it if needed

If it does not trigger, say “use the Excel工具 skill”. In Codex, type $Excel工具.

The skill itself

SKILL.md

FolderGitHub

Excel 工具

原则

  • 输入表格只读,输出写入 PROJECT_ROOT。
  • 普通结果汇总优先 CSV。
  • 题目指定 XLSX、需保留公式、多工作表或模板结构时才使用 XLSX。
  • 不覆盖题目原始附件和 Skill 文件。

读取与写入

import pandas as pd

# 第一行就是数据时必须显式使用 header=None。
data = pd.read_excel("data/input.xlsx", sheet_name=0, header=None)
assert len(data) == 7470, f"行数异常: {len(data)}"
result = pd.DataFrame({"方案": names, "目标值": values})
result.to_excel("results/结果.xlsx", index=False)

禁止依赖 pandas.read_excel() 默认的 header=0 猜测表头,否则第一行数据会被当成列名。未知表头结构或必须精确保留行时使用无隐式推断的读取工具:

from scripts.read_rows import read_excel_rows

rows = read_excel_rows(
    "data/input.xlsx",
    header=False,
    expected_rows=7470,
)
assert rows[0][0] == 399.6747

读取后必须核对首行、末行、原始工作表有效行数和题目声明的记录数;行数不符时立即报错,不得静默继续建模。

使用模板时用 openpyxl.load_workbook() 打开,写入指定单元格后另存新文件。不要删除未知工作表、命名区域、公式或验证规则。

公式重算

openpyxl 不计算公式。修改含公式的工作簿后使用 LibreOffice 隔离重算:

python scripts/recalc.py "<PROJECT_ROOT>/results/结果.xlsx" 60

工具会:

  1. 使用唯一临时 LibreOffice 配置;
  2. 把重算结果写入临时目录;
  3. 检查常见 Excel 错误;
  4. 仅在成功后原子替换目标文件;
  5. 超时、失败或未生成输出时保留原文件。

DOCX 与 XLSX 共用的 OOXML/LibreOffice 基础代码位于 ../docx/scripts/office/,本工具不再维护重复副本。

检查

  • 公式引用和范围正确。
  • 工作表名、列名、数据类型和单位正确。
  • 已显式声明是否有表头,首行、末行和预期数据行数均已核对。
  • 无 #VALUE!、#DIV/0!、#REF!、#NAME?、#NULL!、#NUM!、#N/A。
  • 结果与代码终端输出和论文表格一致。

Tips for Excel工具

  • • Start a fresh session after installing so your agent picks up the new skill.
  • • This skill ships scripts. Read them before the first run, and run it in a project without secrets first.
  • • It is part of a pack with 5 skills. Install only the ones you need with --skill to keep triggers precise.
  • • If two skills overlap, mention the one you want by name.

Questions about Excel工具

What does the Excel工具 skill do?

读取、创建、修改和验证 XLSX,支持模板保留、公式重算和错误检查。

How do I install Excel工具?

Run "npx skills add XiaoMaColtAI/math-modeling-skill --skill Excel工具" in your project. The skills CLI installs it for Claude Code, Cursor, Codex and 70+ other agents. In Claude on the web, upload the skill folder as a ZIP under Customize > Skills.

Does Excel工具 work in Cursor and Codex?

Yes. Excel工具 uses the open SKILL.md format, so it works in Claude Code, Claude, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot and other agents that support agent skills.

Is Excel工具 free?

Excel工具 is open source on GitHub. It is free to install; check the license before commercial use.

Who made Excel工具?

Excel工具 is published by XiaoMaColtAI in the XiaoMaColtAI/math-modeling-skill repository, together with 4 other skills.

Similar skills. From other creators.