Install any skill in seconds. Free to start, no credit card required.
Get Started Free →用于分析包含多个Sheet的Excel文件,动态判断数据量级以决定是否转换为Parquet进行大文件处理,并支持跨Sheet的特定字段统计、数据清洗、交叉分析与可视化,最终生成带下载链接的汇总报告。
.claude/skills/opensensenova-excel-multi-sheet-dynamic-analysis/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -1% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 9% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -5% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 63% | 0% |
| case-06 | ✓→✗ | ▼ Worse | 92% | 0% |
Step1 遍历所有sheet,灵活定位目标列并统计特定类型字段的数量。
pythontarget_col_keyword = 'type' # 占位示例 target_val_keyword = 'varchar' # 占位示例 total_target_count = 0 target_details = [] for sheet_name in wb.sheetnames: ws = wb[sheet_name] raw_data = list(ws.iter_rows(values_only=True)) # 实用技巧:灵活策略定位目标列,通过扫描前几行数据内容定位表头行 header_row_idx = None for i, row in enumerate(raw_data): if any(cell and isinstance(cell, str) and target_col_keyword in str(cell).lower() for cell in row): header_row_idx = i break if header_row_idx is not None: header = raw_data[header_row_idx] type_col_idx = next((j for j, col in enumerate(header) if col and target_col_keyword in str(col).lower()), None) if type_col_idx is not None: target_count = 0 target_fields = [] for i in range(header_row_idx + 1, len(raw_data)): row = raw_data[i] if len(row) <= type_col_idx: continue cell_val = row[type_col_idx] if cell_val and isinstance(cell_val, str) and target_val_keyword in cell_val.lower(): target_count += 1 field_name = row[0] if len(row) > 0 else None if field_name and field_name not in target_fields: target_fields.append(field_name) total_target_count += target_count target_details.append({ 'sheet': sheet_name, 'target_count': target_count, 'target_fields': target_fields[:10] })
Step2 对特定Sheet进行数据清洗、分类映射、多维度评分及交叉聚合分析。
pythonimport pandas as pd import re # 读取特定Sheet并处理列名 sheet1_df = pd.read_excel(file_path, sheet_name='Sheet1', engine='openpyxl', header=None, skiprows=1) sheet1_df.columns = ['id_col', 'name_col', 'year_col', 'value_col', 'group_col'] # 占位示例 # 合并单元格处理(ffill + 遍历还原) sheet1_df['group_col'] = sheet1_df['group_col'].ffill() # 数据清洗正则表达式 (提取数值) sheet1_df['value_col'] = sheet1_df['value_col'].astype(str).str.replace(r'[^\d.]', '', regex=True) sheet1_df['value_col'] = pd.to_numeric(sheet1_df['value_col'], errors='coerce').fillna(0) # 分类映射函数骨架(具体值替换为占位示例,保留函数结构) def map_category(val): if pd.isna(val): return 'Unknown' if 'keyword' in str(val): return 'Category A' # 占位示例 return 'Other' sheet1_df['mapped_category'] = sheet1_df['name_col'].apply(map_category) # 多维度评分/分级算法结构 def calculate_score(row): score = 0 if row['value_col'] > 100: score += 50 # 占位示例 if row['mapped_category'] == 'Category A': score += 50 return score sheet1_df['score'] = sheet1_df.apply(calculate_score, axis=1) # 筛选特定条件的数据 target_val = 'target_value' # 占位示例 filtered_df = sheet1_df[sheet1_df['group_col'] == target_val] count = len(filtered_df) total_value = filtered_df['value_col'].sum() # value_counts + 占比 + 总计行 stats_df = sheet1_df['group_col'].value_counts().rename('数量').to_frame() stats_df['占比'] = sheet1_df['group_col'].value_counts(normalize=True).apply(lambda x: f"{x:.2%}") stats_df.loc['总计'] = [stats_df['数量'].sum(), '100.00%'] # 交叉分析 crosstab/pivot cross_table = pd.crosstab(sheet1_df['group_col'], sheet1_df['mapped_category'], margins=True, margins_name='总计') result_df = pd.DataFrame({ '统计项': [f'{target_val} 数量', f'{target_val} 总值'], '数值': [count, total_value] })
Step3 对统计结果进行可视化图表绘制与美化。
pythonimport matplotlib.pyplot as plt import seaborn as sns import os # 中英文字体配置 (SimHei, DejaVu Sans) plt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans'] plt.rcParams['axes.unicode_minus'] = False # 图表美化(dpi、颜色方案、标签位置) plt.figure(figsize=(10, 6), dpi=120) plot_data = stats_df.drop('总计') # 排除总计行进行绘图 ax = sns.barplot(x=plot_data.index, y=plot_data['数量'], palette='Blues_d') # 标签位置优化 for p in ax.patches: ax.annotate(f'{int(p.get_height())}', (p.get_x() + p.get_width() / 2., p.get_height()), ha='center', va='bottom', fontsize=10) plt.title('各分组数量统计') plt.xlabel('分组') plt.ylabel('数量') plt.tight_layout() plot_path = os.path.join(os.getcwd(), 'stats_chart.png') plt.savefig(plot_path) plt.close()
Step4 将所有分析结果保存为Excel文件,并生成可点击的下载链接。
pythonfrom datetime import datetime from IPython.display import HTML, display import os summary_df = pd.DataFrame([{'total_target_count': total_target_count}]) details_df = pd.DataFrame(target_details) timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") output_filename = f"analysis_result_{timestamp}.xlsx" output_path = os.path.join(os.getcwd(), output_filename) with pd.ExcelWriter(output_path, engine='openpyxl') as writer: summary_df.to_excel(writer, sheet_name='汇总表', index=False) details_df.to_excel(writer, sheet_name='详细列表', index=False) result_df.to_excel(writer, sheet_name='特定条件统计', index=False) stats_df.to_excel(writer, sheet_name='分组统计') cross_table.to_excel(writer, sheet_name='交叉分析') print(f"\n文件已保存至: {output_path}") # 下载链接生成 download_link = f'<a href="{output_path}" download="{output_path}">点击下载分析结果</a>' display(HTML(download_link))
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 26,710 | 11,483 | -57% | 1 | 1 | 0% | 4,619 | 4,578 | -1% | 0 | 0 | — |
case-02 | fail→pass | 22,181 | 18,962 | -15% | 1 | 1 | 0% | 4,712 | 5,150 | +9% | 0 | 0 | — |
case-03 | fail→pass | 24,940 | 16,138 | -35% | 1 | 1 | 0% | 5,688 | 5,424 | -5% | 0 | 0 | — |
case-04 | pass→pass | 9,921 | 8,122 | -18% | 1 | 1 | 0% | 1,905 | 3,694 | +94% | 0 | 0 | — |
case-05 | fail→fail | 14,758 | 10,150 | -31% | 1 | 1 | 0% | 1,934 | 3,664 | +89% | 0 | 0 | — |
case-06 | pass→fail | 8,634 | 6,387 | -26% | 1 | 1 | 0% | 1,614 | 3,092 | +92% | 0 | 0 | — |
case-07 | pass→pass | 6,914 | 5,574 | -19% | 1 | 1 | 0% | 1,326 | 2,709 | +104% | 0 | 0 | — |
case-08 | pass→pass | 5,544 | 3,824 | -31% | 1 | 1 | 0% | 1,153 | 2,570 | +123% | 0 | 0 | — |
case-09 | pass→pass | 9,406 | 7,658 | -19% | 1 | 1 | 0% | 1,447 | 2,824 | +95% | 0 | 0 | — |
case-10 | pass→pass | 7,191 | 5,599 | -22% | 1 | 1 | 0% | 1,502 | 2,911 | +94% | 0 | 0 | — |
case-11 | pass→pass | 8,338 | 6,820 | -18% | 1 | 1 | 0% | 1,778 | 3,223 | +81% | 0 | 0 | — |
case-12 | pass→pass | 8,627 | 7,646 | -11% | 1 | 1 | 0% | 2,055 | 3,437 | +67% | 0 | 0 | — |
case-13 | pass→pass | 5,019 | 2,928 | -42% | 1 | 1 | 0% | 1,025 | 2,499 | +144% | 0 | 0 | — |
case-14 | fail→pass | 14,054 | 9,237 | -34% | 1 | 1 | 0% | 2,207 | 3,594 | +63% | 0 | 0 | — |
case-15 | pass→pass | 7,425 | 6,992 | -6% | 1 | 1 | 0% | 1,308 | 2,951 | +126% | 0 | 0 | — |
case-16 | pass→pass | 8,315 | 3,809 | -54% | 1 | 1 | 0% | 1,304 | 2,562 | +96% | 0 | 0 | — |
case-17 | pass→pass | 9,273 | 8,882 | -4% | 1 | 1 | 0% | 1,752 | 3,434 | +96% | 0 | 0 | — |
case-18 | pass→pass | 7,889 | 8,177 | +4% | 1 | 1 | 0% | 1,590 | 3,391 | +113% | 0 | 0 | — |
case-19 | pass→pass | 6,880 | 3,379 | -51% | 1 | 1 | 0% | 1,079 | 2,488 | +131% | 0 | 0 | — |
case-20 | pass→pass | 8,159 | 11,342 | +39% | 1 | 1 | 0% | 1,727 | 3,545 | +105% | 0 | 0 | — |
case-21 | pass→pass | 9,440 | 10,278 | +9% | 1 | 1 | 0% | 1,940 | 3,898 | +101% | 0 | 0 | — |
case-22 | pass→pass | 14,846 | 24,287 | +64% | 1 | 1 | 0% | 3,344 | 6,021 | +80% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.