返回 Skill 列表
extension
分类: 数据与分析无需 API Key

企业Excel清单清洗入口 — Excel Cleaner

其他 Excel 清洗工具都要你先回答一个问题:这是什么表? 问题是,很多时候提问的人自己也说不准。一份「到货清单」既像入库又像采购;一份标题写着「采购订单」的表,列里却是账面数量和实盘数量——它其实是盘点表。选错了工具,套上错误的模板,清洗出来的东西比原表还难用。 本 Skill 把这一步拿掉。上传,然后拿结果。 一、九层证据自动识别。表格结构、专有表头组合、数据分布、顶部标题、Sheet 名、文件名、合并单元格、说明文字、正文关键词——九个位置分权重取证。结构证据的权重高于文字证据:标题写「采购订单」但列里是账面/实盘成对的表,会被判为盘点表。标题赢不了结构。 二、判断过程全部摊开。处理报告里有完整的候选排序(四类各自的得分与置信度)和命中证据(每条证据来自哪一层、哪个位置、加了多少分、为什么)。自动识别如果不可解释,就没有理由信任它。 三、路由前先做只读预检。选定候选后,先用对应模块做一次只读兼容性检查——必填字段在不在、有没有冲突字段、能不能抽出至少一条可清洗的数据行。第一候选预检失败会自动落到第二候选,并在报告里写明第一候选为什么失败。整个过程不打断你。 四、输出必须先通过验证。清洗完不直接交付,先校验:工作表和表头是否完整、必填字段有没有空、数量是不是数字、差异数量是否等于实盘减账面、小计是否等于数量乘单价、汇总数字与明细对不对得上。验证不通过就不给结果,半成品直接丢弃,只留一份说明。 五、判不出来就说判不出来。四类都识别不了、文件损坏、所有模块预检都失败、工作簿里混了多种业务类型、清洗结果没通过验证——这五种情况直接停下,说明原因,不把文件硬塞进某个分类。一份员工通讯录不该被清洗成入库单。 覆盖四类企业清单:物资入库清单、采购清单/采购订单、盘点表、供应商报价单。四套清洗逻辑都打进了包内,运行时不调用任何外部服务。 产出:清洗后的 Excel 一份,对应类型的处理报告一份,行级错误 CSV 一份,外加本 Skill 独有的「处理报告.md」(候选排序、命中证据、预检结果、自动验证)与只读的「识别证据.xlsx」。 本 Skill 不连接任何生产系统,不下单,不做财务核算,不判断盘点差异责任,不推荐中标供应商。它把表整理好并说明凭什么这么整理,业务判断仍然是你的。

person作者: u_d1525ce8hubenterprise

企业 Excel 清单清洗总入口 — Enterprise Excel Cleaner

Take one messy enterprise Excel list, decide what it is, clean it with the matching bundled module, validate the result, and hand back the cleaned workbook. Fully automatic: the user never picks a type and never confirms a guess.

Core Boundary

This skill is offline and file-based.

  • Do not connect to any live purchasing, warehouse, or finance system.
  • Do not read or write any production database.
  • Do not place orders, approve purchases, post stock movements, or call any API.
  • Do not perform financial accounting, tax calculation, or price compliance judgement.
  • Never modify the uploaded workbook. Every layer opens it read-only.
  • Never call another Skill at runtime. The four cleaning modules are bundled inside this package.

Fixed Flow

上传 Excel → 自动分析 → 自动识别 → 包内自动路由 → 自动清洗 → 自动验证 → 输出 Excel

Four layers, in this order, all inside the package:

| 层 | 模块 | 职责 | | --- | --- | --- | | 识别 | recognizer.py | 结构、表头、标题、Sheet 名、文件名、合并单元格、说明文字、正文关键词多层取证并打分 | | 预检 | precheck.py | 对候选类型做只读兼容性预检,必填字段、专有字段、冲突字段、可用数据行 | | 调度清洗 | dispatcher.py | 按候选顺序选择第一个预检通过的模块并执行清洗 | | 输出验证 | validator.py | 校验输出工作簿的 Sheet、表头、数量金额一致性、报告与 errors.csv |

Only when validation passes does the router return success. If validation fails, the partial outputs are discarded and nothing is presented as a result.

Behaviour Rules

  1. Never ask the user which type it is. Recognition is the product. Asking the user to confirm defeats the purpose of this entry skill.
  2. Never announce intermediate guesses. Do not narrate "看起来像采购清单". Run the pipeline and report the final outcome.
  3. Only deliver the final result. Hand the user the cleaned Excel plus 处理报告.md. Do not paste the whole report body into the chat.
  4. Never mention the four vertical Skills by slug. Inside this entry skill the modules are inbound / purchase / stocktake / quotation, not separately published products. The router already strips legacy "可能选错了 Skill" hints from bundled module reports.
  5. Structure beats keywords. A title saying 采购 does not outrank an 账面数量 + 实盘数量 column pair. Recognition already encodes this; do not override it.

Supported Types

| 模块 | 场景 | 主输出 | | --- | --- | --- | | inbound | 物资入库清单 | cleaned_inbound_template.xlsx | | purchase | 采购清单 / 采购订单 | cleaned_purchase_template.xlsx | | stocktake | 盘点表 | cleaned_stocktake_template.xlsx | | quotation | 供应商报价单 | quotation_comparison.xlsx |

Not covered in v0.1.0: 领料 / 申领清单、工资考勤财务报销等高风险场景、图片型表格、 PDF 表格、扫描件 OCR、一个工作簿混合多种业务类型且要求一次全部清洗。

Safe Stop

Stop only in these cases, and say so plainly:

  • 四类均无法可靠识别(unsupported
  • 文件损坏或无法读取(报告中带 文件读取失败
  • 所有候选模块预检均失败(unsupported
  • 同一工作簿混有多种业务类型(multi_sheet_conflict / multi_sheet_unsupported
  • 清洗结果未通过自动验证(validation_failed

When stopping, tell the user 「不支持或无法可靠处理」, point at 处理报告.md, and suggest splitting mixed workbooks into separate files. Never force a file into a category just to produce output.

Script

One command does everything:

python3 scripts/clean_enterprise_excel.py input.xlsx --out-dir outputs

Exit codes: 0 cleaned and validated, 2 safely stopped, 1 internal error. Add --json when the result needs to be consumed programmatically.

Outputs in --out-dir:

  • the cleaned workbook (name depends on the recognised type)
  • the module report (import_report.md / purchase_report.md / stocktake_report.md / quotation_report.md), with legacy Skill hints removed
  • errors.csv
  • 处理报告.md — the unified 07 report: 候选排序、命中证据、预检结果、自动验证、 输出文件完整性、关键字段
  • 识别证据.xlsx — the same evidence as a read-only workbook

Python API:

from enterprise_excel_cleaner.router import analyze_workbook, clean_enterprise_excel

result = clean_enterprise_excel("input.xlsx", "outputs")
result.status            # "success" | "unsupported" | "validation_failed" | ...
result.selected_type     # "inbound" | "purchase" | "stocktake" | "quotation" | None
result.output_file       # Path | None,只有验证通过才非空
result.used_external_skill  # 恒为 False

analyze_workbook is read-only and never cleans anything — use it when you only need the recognition evidence.

Module Sync

The four cleaning modules are copies of the corresponding vertical cleaners. MODULE_SYNC.md records upstream version, path, source SHA-256 and copy SHA-256.

python3 scripts/check_module_drift.py

Read-only: reports current / changed / missing, never copies and never overwrites. On changed, do a sync review and a full regression run before touching the bundled copy, then update MODULE_SYNC.md and this skill's version.

Human Review

The output is a preparation file, not a system of record. Structural and arithmetic consistency is checked automatically; business correctness is not. Tell the user to review quantities and amounts before importing anything.