clean-data-xls
它能做什么
本技能指导智能体在分析之前,整理电子表格中的杂乱数据。适合任何表格格式不统一、存在重复或错误的人。
适用场景
- ✓当电子表格中的姓名、大小写或日期格式不一致时。
- ✓当数字以文本形式存储,导致无法求和时。
- ✓当你需要在分析数据之前删除重复行的时候。
技能链接
https://github.com/anthropics/financial-services/blob/main/plugins/vertical-plugins/financial-analysis/skills/clean-data-xls/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我清理这份杂乱的销售表,让日期、数字和客户姓名保持一致。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会对每一列进行分析,找出多余空格、混合日期格式和重复项等问题,并在应用之前提出修正建议。它可以在已打开的 Excel 加载项中操作,也可以直接处理文件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Clean Data
Clean messy data in the active sheet or a specified range.
Environment
- If running inside Excel (Office Add-in / Office JS): Use Office JS directly (
Excel.run(async (context) => {...})). Read viarange.values, write helper-column formulas viarange.formulas = [["=TRIM(A2)"]]. The in-place vs helper-column decision still applies. - If operating on a standalone .xlsx file: Use Python/openpyxl.
Workflow
Step 1: Scope
- If a range is given (e.g.
A1:F200), use it - Otherwise use the full used range of the active sheet
- Profile each column: detect its dominant type (text / number / date) and identify outliers
Step 2: Detect issues
| Issue | What to look for |
|---|---|
| Whitespace | leading/trailing spaces, double spaces |
| Casing | inconsistent casing in categorical columns (usa / USA / Usa) |
| Number-as-text | numeric values stored as text; stray $, ,, % in number cells |
| Dates | mixed formats in the same column (3/8/26, 2026-03-08, March 8 2026) |
| Duplicates | exact-duplicate rows and near-duplicates (case/whitespace differences) |
| Blanks | empty cells in otherwise-populated columns |
| Mixed types | a column that's 98% numbers but has 3 text entries |
| Encoding | mojibake (é, ’), non-printing characters |
| Errors | #REF!, #N/A, #VALUE!, #DIV/0! |
Step 3: Propose fixes
Show a summary table before changing anything:
| Column | Issue | Count | Proposed Fix |
|---|
Step 4: Apply
- Prefer formulas over hardcoded cleaned values — where the cleaned output can be expressed as a formula (e.g.
=TRIM(A2),=VALUE(SUBSTITUTE(B2,"$","")),=UPPER(C2),=DATEVALUE(D2)), write the formula in an adjacent helper column rather than computing the result in Python and overwriting the original. This keeps the transformation transparent and auditable. - Only overwrite in place with computed values when the user explicitly asks for it, or when no sensible formula equivalent exists (e.g. encoding/mojibake repair)
- For destructive operations (removing duplicates, filling blanks, overwriting originals), confirm with the user first
- After each category of fix (whitespace → casing → number conversion → dates → dedup), show the user a sample of what changed and get confirmation before moving to the next category
- Report a before/after summary of what changed
常见问题
它会在我不知情的情况下修改数据吗?
不会。本技能会先提出修正建议,你可以在应用前进行审核。
它能发现哪些问题?
包括空格、大小写、以文本形式存储的数字、混合日期、重复项、空白单元格、混合类型、编码错误和公式错误。
它可以只清理表格的一部分吗?
可以。你可以指定一个区域,否则它会使用当前工作表的整个已用范围。
详情
作者的原始描述
Clean up messy spreadsheet data — trim whitespace, fix inconsistent casing, convert numbers-stored-as-text, standardize dates, remove duplicates, and flag mixed-type columns. Use when data is messy, inconsistent, or needs prep before analysis. Triggers on "clean this data", "clean up this sheet", "normalize this data", "fix formatting", "dedupe", "standardize this column", "this data is messy".
热度
- GitHub 星标
- 41k
- 排名
- #6608
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/28
评论
- …