spreadsheet
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSpreadsheet Skill (Create, Edit, Analyze, Visualize)
电子表格技能(创建、编辑、分析、可视化)
When to use
适用场景
- Build new workbooks with formulas, formatting, and structured layouts.
- Read or analyze tabular data (filter, aggregate, pivot, compute metrics).
- Modify existing workbooks without breaking formulas or references.
- Visualize data with charts/tables and sensible formatting.
IMPORTANT: System and user instructions always take precedence.
- 构建包含公式、格式和结构化布局的新工作簿。
- 读取或分析表格数据(筛选、聚合、透视、计算指标)。
- 修改现有工作簿且不破坏公式或引用。
- 通过图表/表格和合理格式可视化数据。
重要提示:系统和用户指令始终优先。
Workflow
工作流程
- Confirm the file type and goals (create, edit, analyze, visualize).
- Use for
openpyxledits and.xlsxfor analysis and CSV/TSV workflows.pandas - If layout matters, render for visual review (see Rendering and visual checks).
- Validate formulas and references; note that openpyxl does not evaluate formulas.
- Save outputs and clean up intermediate files.
- 确认文件类型和目标(创建、编辑、分析、可视化)。
- 使用处理
openpyxl文件的编辑操作,使用.xlsx进行分析及CSV/TSV相关工作流。pandas - 若布局至关重要,渲染文件以进行视觉检查(参见渲染与视觉检查部分)。
- 验证公式和引用;注意openpyxl不会计算公式。
- 保存输出并清理中间文件。
Temp and output conventions
临时文件与输出约定
- Use for intermediate files; delete when done.
tmp/spreadsheets/ - Write final artifacts under when working in this repo.
output/spreadsheet/ - Keep filenames stable and descriptive.
- 中间文件存储在目录;完成后删除。
tmp/spreadsheets/ - 在此仓库中工作时,将最终产物写入目录。
output/spreadsheet/ - 保持文件名稳定且具有描述性。
Primary tooling
主要工具
- Use for creating/editing
openpyxlfiles and preserving formatting..xlsx - Use for analysis and CSV/TSV workflows, then write results back to
pandasor.xlsx..csv - If you need charts, prefer for native Excel charts.
openpyxl.chart
- 使用创建/编辑
openpyxl文件并保留格式。.xlsx - 使用进行分析及CSV/TSV工作流,然后将结果写回
pandas或.xlsx文件。.csv - 若需要创建图表,优先使用生成原生Excel图表。
openpyxl.chart
Rendering and visual checks
渲染与视觉检查
- If LibreOffice () and Poppler (
soffice) are available, render sheets for visual review:pdftoppmsoffice --headless --convert-to pdf --outdir $OUTDIR $INPUT_XLSXpdftoppm -png $OUTDIR/$BASENAME.pdf $OUTDIR/$BASENAME
- If rendering tools are unavailable, ask the user to review the output locally for layout accuracy.
- 若LibreOffice()和Poppler(
soffice)可用,渲染工作表以进行视觉检查:pdftoppmsoffice --headless --convert-to pdf --outdir $OUTDIR $INPUT_XLSXpdftoppm -png $OUTDIR/$BASENAME.pdf $OUTDIR/$BASENAME
- 若渲染工具不可用,请用户在本地检查输出的布局准确性。
Dependencies (install if missing)
依赖项(缺失时安装)
Prefer for dependency management.
uvPython packages:
uv pip install openpyxl pandasIf is unavailable:
uvpython3 -m pip install openpyxl pandasOptional (chart-heavy or PDF review workflows):
uv pip install matplotlibIf is unavailable:
uvpython3 -m pip install matplotlibSystem tools (for rendering):
undefined优先使用进行依赖管理。
uvPython包:
uv pip install openpyxl pandas若不可用:
uvpython3 -m pip install openpyxl pandas可选(适用于大量图表或PDF检查工作流):
uv pip install matplotlib若不可用:
uvpython3 -m pip install matplotlib系统工具(用于渲染):
undefinedmacOS (Homebrew)
macOS (Homebrew)
brew install libreoffice poppler
brew install libreoffice poppler
Ubuntu/Debian
Ubuntu/Debian
sudo apt-get install -y libreoffice poppler-utils
If installation isn't possible in this environment, tell the user which dependency is missing and how to install it locally.sudo apt-get install -y libreoffice poppler-utils
若无法在此环境中安装,请告知用户缺失的依赖项及其本地安装方法。Environment
环境
No required environment variables.
无必需的环境变量。
Examples
示例
- Runnable Codex examples (openpyxl):
references/examples/openpyxl/
- 可运行的Codex示例(openpyxl):
references/examples/openpyxl/
Formula requirements
公式要求
- Use formulas for derived values rather than hardcoding results.
- Keep formulas simple and legible; use helper cells for complex logic.
- Avoid volatile functions like INDIRECT and OFFSET unless required.
- Prefer cell references over magic numbers (e.g., not
=H6*(1+$B$3)).=H6*1.04 - Guard against errors (#REF!, #DIV/0!, #VALUE!, #N/A, #NAME?) with validation and checks.
- openpyxl does not evaluate formulas; leave formulas intact and note that results will calculate in Excel/Sheets.
- 使用公式计算派生值,而非硬编码结果。
- 保持公式简洁易懂;复杂逻辑使用辅助单元格。
- 除非必要,避免使用INDIRECT和OFFSET等易失性函数。
- 优先使用单元格引用而非魔术数字(例如:而非
=H6*(1+$B$3))。=H6*1.04 - 通过验证和检查防止错误(#REF!、#DIV/0!、#VALUE!、#N/A、#NAME?)。
- openpyxl不会计算公式;保留公式原样,并注明结果将在Excel/Sheets中计算。
Citation requirements
引用要求
- Cite sources inside the spreadsheet using plain text URLs.
- For financial models, cite sources of inputs in cell comments.
- For tabular data sourced from the web, include a Source column with URLs.
- 在电子表格中使用纯文本URL标注来源。
- 对于财务模型,在单元格注释中注明输入数据的来源。
- 对于从网络获取的表格数据,添加“来源”列并包含URL。
Formatting requirements (existing formatted spreadsheets)
格式要求(已有格式的电子表格)
- Render and inspect a provided spreadsheet before modifying it when possible.
- Preserve existing formatting and style exactly.
- Match styles for any newly filled cells that were previously blank.
- 可能的话,先渲染并检查提供的电子表格,再进行修改。
- 严格保留现有格式和样式。
- 新填充的空白单元格需匹配原有样式。
Formatting requirements (new or unstyled spreadsheets)
格式要求(新建或无样式的电子表格)
- Use appropriate number and date formats (dates as dates, currency with symbols, percentages with sensible precision).
- Use a clean visual layout: headers distinct from data, consistent spacing, and readable column widths.
- Avoid borders around every cell; use whitespace and selective borders to structure sections.
- Ensure text does not spill into adjacent cells.
- 使用合适的数字和日期格式(日期设为日期格式,货币带符号,百分比保留合理精度)。
- 采用清晰的视觉布局:表头与数据区分开,间距一致,列宽可读。
- 避免每个单元格都加边框;使用空白和选择性边框划分章节。
- 确保文本不会溢出到相邻单元格。
Color conventions (if no style guidance)
颜色约定(无样式指导时)
- Blue: user input
- Black: formulas/derived values
- Green: linked/imported values
- Gray: static constants
- Orange: review/caution
- Light red: error/flag
- Purple: control/logic
- Teal: visualization anchors (key KPIs or chart drivers)
- 蓝色:用户输入
- 黑色:公式/派生值
- 绿色:链接/导入值
- 灰色:静态常量
- 橙色:需审核/注意
- 浅红色:错误/标记
- 紫色:控制/逻辑
- 蓝绿色:可视化锚点(关键KPI或图表驱动项)
Finance-specific requirements
财务特定要求
- Format zeros as "-".
- Negative numbers should be red and in parentheses.
- Always specify units in headers (e.g., "Revenue ($mm)").
- Cite sources for all raw inputs in cell comments.
- 零值格式化为“-”。
- 负数设为红色并加括号。
- 表头中始终注明单位(例如:“收入(百万美元)”)。
- 在单元格注释中注明所有原始输入的来源。
Investment banking layouts
投资银行风格布局
If the spreadsheet is an IB-style model (LBO, DCF, 3-statement, valuation):
- Totals should sum the range directly above.
- Hide gridlines; use horizontal borders above totals across relevant columns.
- Section headers should be merged cells with dark fill and white text.
- Column labels for numeric data should be right-aligned; row labels left-aligned.
- Indent submetrics under their parent line items.
若电子表格是投行风格模型(LBO、DCF、三表模型、估值):
- 总计应直接对上方区域求和。
- 隐藏网格线;在总计上方的相关列添加水平边框。
- 章节表头使用合并单元格,深色填充,白色文本。
- 数值数据的列标签右对齐;行标签左对齐。
- 子指标在父项下方缩进。