← Back to Skills Marketplace
runkecheng

excel-table-structurer

by runkecheng · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
68
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install excel-table-structurer
Description
结构化整理层级型 Excel 表格(.xlsx),处理父子层级关系、向下填充、分组首行显示、筛选优化。当用户上传 Excel 文件并要求「结构化整理」「填充数据」「整理表格」「整理测试用例」「清理表格格式」时使用。
README (SKILL.md)

Excel 表格结构化整理

核心概念

很多业务表格(如测试用例、项目清单、台账)是层级结构的:

A列(业务场景) → B列(测试分类) → C列(用例编号) + D/E列(信息)
                                      ↓
                                F列(操作步骤1) + G列(期望结果1)
                                F列(操作步骤2) + G列(期望结果2)
                                ...

处理这类表格的核心操作:

操作 说明 示例
fill-down 父层级值向下填充到所有子行 业务场景、测试分类每行都可见
group-header 组级信息仅首行显示 用例编号/名称仅在用例首行
fill-down-group 组级信息填充到所有行(便于筛选) 测试结论向下填充,筛选 fail 可看完整步骤

使用方法

快速上手

python3 scripts/restructure.py 输入文件.xlsx 输出文件.xlsx --spec '\x3CJSON_SPEC>'

JSON_SPEC 定义列的层级角色。

分析表格结构

收到用户文件后,先读取数据确认层级关系:

  1. 哪些列是父层级(A/B列),需要fill-down
  2. 哪一列是分组键(C列,定义行组),需要group-header
  3. 哪些列携带组级信息(H列测试结论),需要fill-down-group
  4. 哪些列需要额外处理

JSON_SPEC 参数说明

{
  "sheet": "Sheet1",                        // 工作表名称(可选,默认 Sheet1)
  "fill_down_columns": [0, 1],              // 父层级列(0-based index)→ 向下填充
  "group_key_column": 2,                    // 分组键列 → 定义行组
  "group_header_columns": [2, 3, 4],        // 组首行列 → 仅首行显示
  "fill_down_group_columns": [7],           // 组级填充列 → 所有行显示(便于筛选)
  "col_widths": {"0": 20, "1": 18},        // 列宽(可选,key=col_index, value=width)
  "freeze_panes": "A2",                    // 冻结窗格(可选,默认 A2)
  "skip_empty_rows": true                  // 跳过空行(可选,默认 true)
}

常见场景

场景一:测试用例整理(本次案例)

A=业务场景, B=测试分类 → fill-down
C=用例编号, D=用例名称, E=前提条件 → group-header(仅有首行)
H=测试结论 → fill-down-group(复制到所有行便于筛选)
{
  "fill_down_columns": [0, 1],
  "group_key_column": 2,
  "group_header_columns": [2, 3, 4],
  "fill_down_group_columns": [7],
  "col_widths": {"0": 20, "1": 18, "2": 14, "3": 35, "4": 40, "5": 55, "6": 45, "7": 12, "8": 35}
}

场景二:项目任务清单

A=项目名称 → fill-down
B=负责人, C=截止日期 → group-header(仅有首行)
D=任务状态 → fill-down-group(所有行可见,便于筛选)
E=任务事项, F=备注 → 每行独有
{
  "fill_down_columns": [0],
  "group_key_column": 1,
  "group_header_columns": [1, 2],
  "fill_down_group_columns": [3]
}

场景三:台账明细表

A=客户名称 → fill-down
B=合同编号, C=合同金额 → group-header
D=开票状态 → fill-down-group
E=发票号, F=开票日期 → 每行独有
{
  "fill_down_columns": [0],
  "group_key_column": 1,
  "group_header_columns": [1, 2],
  "fill_down_group_columns": [3]
}

输出格式

  • 首行冻结 + 自动筛选
  • 组交替底色(白/浅灰)
  • 结论列自动着色(pass=绿, fail=红, 无法测试=黄)
  • fail 行左侧红色边框高亮

输出说明

运行后脚本返回统计信息:

{"total_rows": 562, "group_count": 119}
  • total_rows = 数据行数(不含表头)
  • group_count = 分组数量(如测试用例数)

使用流程

  1. 用户发送 Excel 文件并说明需求
  2. 读取文件,分析列层级关系
  3. 构造 JSON_SPEC
  4. 运行 restructure.py
  5. 验证输出,将结果文件发送给用户
Usage Guidance
Install only if you want automated restructuring of hierarchical Excel files. Before use, confirm the workbook, sheet, columns, and output filename, and review the generated workbook because fill-down and group transformations can change how spreadsheet meaning is displayed.
Capability Assessment
Purpose & Capability
The stated purpose is hierarchical Excel restructuring, and the script performs matching .xlsx parsing, fill-down/group-header transformations, formatting, and output workbook generation.
Instruction Scope
The workflow is scoped to user-provided Excel files, but trigger phrases are broad and the instructions do not require a clear pre-run confirmation or dry-run summary before transforming spreadsheet content.
Install Mechanism
The artifact contains a SKILL.md and one Python helper script using openpyxl; static scan and VirusTotal telemetry are clean.
Credentials
Reading a supplied workbook and writing a separate output path is proportionate to the spreadsheet-cleanup purpose; no network calls, credential access, local profile access, or broad filesystem indexing were found.
Persistence & Privilege
No background worker, startup hook, persistence mechanism, privilege escalation, destructive command, or session/profile handling is present.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install excel-table-structurer
  3. After installation, invoke the skill by name or use /excel-table-structurer
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of excel-table-structurer. - Supports hierarchical Excel tables: fill-down, group-header, fill-down-group, column grouping, and format cleanup. - Allows users to define table structure using a JSON specification. - Provides output with frozen headers, auto-filter, alternating row colors, conditional cell coloring, and group count statistics. - Easy command-line interface for processing and restructuring uploaded Excel files.
Metadata
Slug excel-table-structurer
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is excel-table-structurer?

结构化整理层级型 Excel 表格(.xlsx),处理父子层级关系、向下填充、分组首行显示、筛选优化。当用户上传 Excel 文件并要求「结构化整理」「填充数据」「整理表格」「整理测试用例」「清理表格格式」时使用。 It is an AI Agent Skill for Claude Code / OpenClaw, with 68 downloads so far.

How do I install excel-table-structurer?

Run "/install excel-table-structurer" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is excel-table-structurer free?

Yes, excel-table-structurer is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does excel-table-structurer support?

excel-table-structurer is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created excel-table-structurer?

It is built and maintained by runkecheng (@runkecheng); the current version is v1.0.0.

💬 Comments