Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

sn-da-excel-workflow

БесплатноБез исполняемых скриптовНе проверен

Excel 数据分析多步编排器。覆盖:(1) 读取多 Sheet Excel 文件并统计行数,(2) 大文件检测(≥10k 行自动 Parquet 优化),(3) 数据清洗(缺失值、文本标准化、无效字符),(4) 条件筛选与分类提取,(5) 跨 Sheet 统计聚合,(6) 导出 Excel/CSV…

OpenSenseNovaот OpenSenseNova★ 6 124 звезды на GitHub

Об этом скилле

Excel Data Analysis Workflow

End-to-end workflow for structured Excel analysis. Each step maps to a capability sub-skill that can be loaded for detailed patterns.

Workflow

Step 1 — Count rows across all sheets (lightweight, no full load)

Count rows per sheet without loading data into memory. Use openpyxl read_only mode — this works for any file size.

import openpyxl, gc

wb = openpyxl.load_workbook(file_path, read_only=True, data_only=True)
total_rows = 0
sheet_info = {}
for name in wb.sheetnames:
    ws = wb[name]
    row_count = sum(1 for _ in ws.iter_rows(min_row=2, values_only=True))
    total_rows += row_count
    sheet_info[name] = row_count
    print(f"Sheet '{name}': {row_count} rows")
wb.close()
print(f"总行数={total_rows}")

⚠️ Do NOT use pd.read_excel() to count rows — it loads all data into memory, which will OOM on large files.

→ capability: excel-reading/multi-sheet-reading

Step 2 — Large file gate (CRITICAL — choose strategy by row count)

total_rows Strategy What to do
< 10k Direct read df = pd.read_excel(file_path, sheet_name=target_sheet)
10k – 100k Parquet cache pd.read_excel() once → df.to_parquet() → all later reads from Parquet
>= 100k STOP. Load sn-da-large-file-analysis skill Read its SKILL.md, then follow its streaming read + Parquet pattern. Do NOT use pd.read_excel() at all — it will OOM or timeout on 100k+ rows.

For >= 100k rows:

read_file(path="<skills_base>/sn-da-large-file-analysis/SKILL.md")

Then use stream_excel_to_parquet() from that skill — it reads via openpyxl iter_rows in 50k-row chunks with constant memory.

For 10k – 100k rows (only):

import pandas as pd
parquet_path = "/tmp/_auto_parquet.parquet"
df = pd.read_excel(file_path, sheet_name=target_sheet)
df.to_parquet(parquet_path, engine="pyarrow")
del df; gc.collect()
df = pd.read_parquet(parquet_path)

→ capability: excel-reading/large-excel-reading

Step 3 — Inspect schema & data types

Preview target sheet structure. For large files (>= 10k rows), only read a small sample — never full load just to inspect.

# For any file size — read only first N rows for inspection
df_head = pd.read_excel(file_path, sheet_name=target_sheet, nrows=20)
print(f"Columns: {df_head.columns.tolist()}")
print(f"Dtypes:\n{df_head.dtypes}")
print(df_head.head(10))

→ capability: excel-reading/range-reading

Step 4 — Data cleaning

Handle missing values, normalize text, clean invalid characters.

# Missing values
null_count = df[col].isna().sum()

# Text cleaning: keep only Chinese characters
import re
def clean_text(val):
    if pd.isna(val): return val
    return "".join(re.findall(r"[\u4e00-\u9fff]", str(val))) or ""

df[col] = df[col].apply(clean_text)

⚠️ Large file rule: When total_rows >= 100k, do NOT use df.apply(lambda...). Use vectorized operations or np.where() instead. See sn-da-large-file-analysis skill for the vectorized cheat sheet.

→ capabilities:

  • excel-data-cleaning/missing-value-handling
  • excel-data-cleaning/invalid-data-cleaning
  • excel-data-cleaning/text-normalization

Step 5 — Filter & extract

Apply condition or category filters, aggregate results.

# Condition filter
mask = df[col].astype(str).str.strip() == target_value
filtered = df[mask]

# Category extraction (for headerless layouts)
df_raw = pd.read_excel(file_path, sheet_name=sheet, header=None)
# Walk rows to find category markers, collect items until next marker

→ capabilities:

  • excel-data-filtering/condition-filtering
  • excel-data-filtering/category-filtering
  • excel-data-filtering/threshold-filtering

Step 6 — Export results

Save filtered/cleaned data as Excel or CSV. Provide download link.

output_path = "/mnt/data/result.xlsx"
result_df.to_excel(output_path, index=False)
print(f"[Download](sandbox:{output_path})")

→ capabilities:

  • excel-result-export/single-sheet-export
  • excel-result-export/formatted-export

Key rules

  • Always count rows first — gate large-file logic on the 10k threshold.
  • >= 100k rows → MUST load sn-da-large-file-analysis skill — do not attempt to handle with pd.read_excel().
  • Column names may contain spaces (e.g. '是否通 过') — use exact string indexing.
  • Headerless sheets — use header=None and positional indexing.
  • Prohibited on large files (>= 100k rows):
    • pd.read_excel() for full load (use streaming read → Parquet)
    • df.apply(lambda...) or df.iterrows() (use vectorized ops or itertuples())
    • fc-list, find ... fonts, subprocess to search fonts, or pip install (use fixed font paths below)
    • Printing all unique values or full DataFrames (use .head(), .value_counts().head())

CJK Font Setup (mandatory for charts)

When generating charts with matplotlib, *copy this block as-is

Полный SKILL.md на GitHub

Установить sn-da-excel-workflow в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

capability/excel-cell-coloring/category-coloring/SKILL.mdcapability/excel-cell-coloring/duplicate-value-coloring/SKILL.mdcapability/excel-cell-coloring/outlier-coloring/SKILL.mdcapability/excel-cell-coloring/threshold-cell-coloring/SKILL.mdcapability/excel-cell-coloring/top-value-coloring/SKILL.mdcapability/excel-conditional-formatting/data-bar-formatting/SKILL.mdcapability/excel-data-analysis/comparison-analysis/SKILL.mdcapability/excel-data-analysis/group-by-analysis/SKILL.mdcapability/excel-data-analysis/kpi-metric-analysis/SKILL.mdcapability/excel-data-analysis/pivot-table-analysis/SKILL.mdcapability/excel-data-analysis/time-series-analysis/SKILL.mdcapability/excel-data-analysis/trend-analysis/SKILL.mdcapability/excel-data-cleaning/duplicate-removal/SKILL.mdcapability/excel-data-cleaning/invalid-data-cleaning/SKILL.mdcapability/excel-data-cleaning/missing-value-handling/SKILL.mdcapability/excel-data-cleaning/numeric-format-normalization/SKILL.mdcapability/excel-data-cleaning/outlier-detection/SKILL.mdcapability/excel-data-cleaning/text-normalization/SKILL.mdcapability/excel-data-filtering/category-filtering/SKILL.mdcapability/excel-data-filtering/condition-filtering/SKILL.mdcapability/excel-data-filtering/range-filtering/SKILL.mdcapability/excel-data-filtering/threshold-filtering/SKILL.mdcapability/excel-data-statistics/basic-statistics/SKILL.mdcapability/excel-data-statistics/category-statistics/SKILL.mdcapability/excel-data-statistics/grouped-statistics/SKILL.mdcapability/excel-data-statistics/percentage-calculation/SKILL.mdcapability/excel-data-visualization/bar-chart-visualization/SKILL.mdcapability/excel-data-visualization/histogram-visualization/SKILL.mdcapability/excel-data-visualization/line-chart-visualization/SKILL.mdcapability/excel-data-visualization/pie-chart-visualization/SKILL.mdcapability/excel-data-visualization/scatter-plot-visualization/SKILL.mdcapability/excel-data-visualization/stacked-chart-visualization/SKILL.mdcapability/excel-reading/large-excel-reading/SKILL.mdcapability/excel-reading/multi-file-reading/SKILL.mdcapability/excel-reading/multi-sheet-reading/SKILL.mdcapability/excel-reading/range-reading/SKILL.mdcapability/excel-reading/single-sheet-reading/SKILL.mdcapability/excel-reading/specific-sheet-reading/SKILL.mdcapability/excel-reading/structured-header-reading/SKILL.mdcapability/excel-result-export/chart-embedded-export/SKILL.md

FAQ

Что делает скилл sn-da-excel-workflow?

Excel 数据分析多步编排器。覆盖:(1) 读取多 Sheet Excel 文件并统计行数,(2) 大文件检测(≥10k 行自动 Parquet 优化),(3) 数据清洗(缺失值、文本标准化、无效字符),(4) 条件筛选与分类提取,(5) 跨 Sheet 统计聚合,(6) 导出 Excel/CSV 并提供下载链接。覆盖从数据读取到报告生成全流程,按步骤编排 capability 子 skill。**遇到以下任一情况就主动使用本 skill,不要自行写几行 pandas 就回答**:①用户出现触发词:Excel 分析 / 表格分析 / 数据分析 / 数据清洗 / 数据统计 / 数据筛选 / 数据可视化 / 数据导出 / 汇总统计 / 透视表 / 分组统计 / 交叉分析 / 趋势分析 / 对比分析 / 异常值检测 / 去重 / 缺失值处理 / Excel 报告 / 生成报表 / analyze Excel / data analysis / data cleaning / pivot table;②用户上传或指定了 .xlsx / .xls / .csv 文件并要求分析、清洗、统计或可视化;③任务涉及多 Sheet 读取、条件筛选、分类汇总、图表生成中的任意一项;④用户要求导出带格式的 Excel 报告或下载链接。仅不用于:不涉及表格数据的纯文本处理、图片分析(使用 sn-da-image-caption)、单个公式计算的简单问答。

Как установить скилл sn-da-excel-workflow?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл sn-da-excel-workflow запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить sn-da-excel-workflow с