From marcelleon-skills-zh
Processes and creates Excel files (.xlsx/.xlsm/.csv/.tsv) with reading, cleaning, formula writing, formatting, charts, and template updates. Emphasizes writing Excel formulas for sustainability and uses recalc to verify error-free formulas.
How this skill is triggered — by the user, by Claude, or both
Slash command
/marcelleon-skills-zh:xlsxThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- 除非用户另有要求,统一使用专业字体(如 Arial、Times New Roman)
LICENSE.txtscripts/office/helpers/__init__.pyscripts/office/helpers/merge_runs.pyscripts/office/helpers/simplify_redlines.pyscripts/office/pack.pyscripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsdscripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsdscripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsdscripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsdscripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsdscripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsdscripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsdscripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsdscripts/office/schemas/ISO-IEC29500-4_2016/pml.xsdscripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsdscripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsdscripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsdscripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsdscripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsdscripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd#REF!/#DIV/0!/#VALUE!/#N/A/#NAME?(0,0,255):可调输入/硬编码假设(0,0,0):公式计算(0,128,0):同工作簿跨表引用(255,0,0):外部文件链接(255,255,0):关键假设或待更新单元格"2024"(避免 2,024)$#,##0,并在表头写明单位(如 ($mm))-(含百分比)0.0%0.0x(123),不用 -123=B5*(1+$B$6),不要 =B5*1.05对硬编码值写明来源(旁注/批注均可):
Source: [System/Document], [Date], [Reference], [URL]
任务通常分为:
scripts/recalc.py)若文件包含公式,交付前必须执行:
python scripts/recalc.py output.xlsx
说明:
openpyxl 只写入公式字符串,不会计算结果scripts/recalc.py 会调用 LibreOffice 回算并扫描错误scripts/office/soffice.py 自动做兼容配置import pandas as pd
df = pd.read_excel("file.xlsx") # 首个 sheet
all_sheets = pd.read_excel("file.xlsx", sheet_name=None) # 全部 sheet
df.head()
df.info()
df.describe()
df.to_excel("output.xlsx", index=False)
不要先在 Python 里算完再把值写回去。
正确做法是把公式写入单元格,让工作簿可持续重算。
total = df["Sales"].sum()
sheet["B10"] = total
growth = (df.iloc[-1]["Revenue"] - df.iloc[0]["Revenue"]) / df.iloc[0]["Revenue"]
sheet["C5"] = growth
sheet["B10"] = "=SUM(B2:B9)"
sheet["C5"] = "=(C4-C2)/C2"
sheet["D20"] = "=AVERAGE(D2:D19)"
pandas,公式/格式用 openpyxlscripts/recalc.py常见错误:
#REF!:引用失效#DIV/0!:分母为零#VALUE!:类型不匹配#NAME?:函数名或命名范围不识别from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill, Alignment
wb = Workbook()
sheet = wb.active
sheet["A1"] = "Hello"
sheet["B1"] = "World"
sheet.append(["Row", "of", "data"])
sheet["B2"] = "=SUM(A1:A10)"
sheet["A1"].font = Font(bold=True, color="FF0000")
sheet["A1"].fill = PatternFill("solid", start_color="FFFF00")
sheet["A1"].alignment = Alignment(horizontal="center")
sheet.column_dimensions["A"].width = 20
wb.save("output.xlsx")
from openpyxl import load_workbook
wb = load_workbook("existing.xlsx")
sheet = wb.active
for sheet_name in wb.sheetnames:
s = wb[sheet_name]
print(sheet_name)
sheet["A1"] = "New Value"
sheet.insert_rows(2)
sheet.delete_cols(3)
new_sheet = wb.create_sheet("NewSheet")
new_sheet["A1"] = "Data"
wb.save("modified.xlsx")
python scripts/recalc.py <excel_file> [timeout_seconds]
python scripts/recalc.py output.xlsx 30
脚本输出 JSON,核心字段示例:
{
"status": "success",
"total_errors": 0,
"total_formulas": 42,
"error_summary": {
"#REF!": {
"count": 2,
"locations": ["Sheet1!B5", "Sheet1!C10"]
}
}
}
NaNSheet1!A1)pandas:批量数据处理、分析、导出openpyxl:公式、样式、工作簿结构控制data_only=True 可读计算值,但保存后会丢公式(高风险)read_only=True / write_only=Truescripts/recalc.pyparse_dates 明确解析npx claudepluginhub joshuarweaver/cascade-code-general-misc-3 --plugin marcelleon-skills-zhCreates, edits, analyzes XLSX spreadsheets (.xlsm, .csv, .tsv) with formulas, formatting, data visualization, and recalculation while preserving structure.
Opens, reads, edits, creates, and converts spreadsheet files (.xlsx, .xlsm, .csv, .tsv). Handles formula fixing, formatting, charting, data cleaning, and restructuring messy tabular data.