Requirements for Outputs
All Excel files
Professional Font
- Use a consistent, professional font (e.g., Arial, Times New Roman) for all deliverables unless otherwise instructed by the user
Zero Formula Errors
- Every Excel model MUST be delivered with ZERO formula errors (#REF!, #DIV/0!, #VALUE!, #N/A, #NAME?)
Preserve Existing Templates (when updating templates)
- Study and EXACTLY match existing format, style, and conventions when modifying files
- Never impose standardized formatting on files with established patterns
- Existing template conventions ALWAYS override these guidelines
Financial models
Color Coding Standards
Unless otherwise stated by the user or existing template
- Blue text (RGB: 0,0,255): Hardcoded inputs, and numbers users will change for scenarios
- Black text (RGB: 0,0,0): ALL formulas and calculations
- Green text (RGB: 0,128,0): Links pulling from other worksheets within same workbook
- Red text (RGB: 255,0,0): External links to other files
- Yellow background (RGB: 255,255,0): Key assumptions needing attention or cells that need to be updated
Number Formatting Standards
- Years: Format as text strings (e.g., "2024" not "2,024")
- Currency: Use $#,##0 format; ALWAYS specify units in headers ("Revenue ($mm)")
- Zeros: Use number formatting to make all zeros "-", including percentages (e.g., "$#,##0;($#,##0);-")
- Percentages: Default to 0.0% format (one decimal)
- Multiples: Format as 0.0x for valuation multiples (EV/EBITDA, P/E)
- Negative numbers: Use parentheses (123) not minus -123
Formula Construction Rules
- Place ALL assumptions in separate assumption cells
- Use cell references instead of hardcoded values in formulas
- Example: Use =B5*(1+$B$6) instead of =B5*1.05
XLSX creation, editing, and analysis
Overview
A user may ask you to create, edit, or analyze the contents of an .xlsx file.
Reading and analyzing data
import pandas as pd
df = pd.read_excel("file.xlsx")
all_sheets = pd.read_excel("file.xlsx", sheet_name=None)
CRITICAL: Use Formulas, Not Hardcoded Values
Always use Excel formulas instead of calculating values in Python and hardcoding them.
❌ WRONG
total = df["Sales"].sum()
sheet["B10"] = total # Hardcodes 5000
✅ CORRECT
sheet["B10"] = "=SUM(B2:B9)"
Common Workflow
Choose tool: pandas for data, openpyxl for formulas/formatting
Create/Load: Create new workbook or load existing file
Modify: Add/edit data, formulas, and formatting
Save: Write to file
Recalculate formulas (MANDATORY IF USING FORMULAS):
python scripts/recalc.py output.xlsx
Verify and fix any errors
Creating new Excel files
from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill, Alignment
wb = Workbook()
sheet = wb.active
sheet["A1"] = "Hello"
sheet["B1"] = "World"
sheet["B2"] = "=SUM(A1:A10)"
sheet["A1"].font = Font(bold=True, color="FF0000")
wb.save("output.xlsx")
Editing existing Excel files
from openpyxl import load_workbook
wb = load_workbook("existing.xlsx")
sheet = wb.active
sheet["A1"] = "New Value"
wb.save("modified.xlsx")
Recalculating formulas
python scripts/recalc.py <excel_file> [timeout_seconds]
The script:
- Automatically sets up LibreOffice macro on first run
- Recalculates all formulas in all sheets
- Scans ALL cells for Excel errors
- Returns JSON with detailed error locations and counts
Formula Verification Checklist
Best Practices
Library Selection
- pandas: Best for data analysis, bulk operations, and simple data export
- openpyxl: Best for complex formatting, formulas, and Excel-specific features
Working with openpyxl
- Cell indices are 1-based
- Use
data_only=True to read calculated values
- Warning: If opened with
data_only=True and saved, formulas are permanently lost
- Formulas are preserved but not evaluated — use
scripts/recalc.py to update values
Code Style Guidelines
- Write minimal, concise Python code without unnecessary comments
- Avoid verbose variable names and redundant operations
- For Excel files: add comments to cells with complex formulas, document data sources for hardcoded values
Dependencies
- pandas: Data analysis and manipulation
- openpyxl: Excel file creation and editing with formulas/formatting
- LibreOffice: Formula recalculation (via
scripts/soffice.py)
1---2name: xlsx3description: Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file; create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path and wants something done to it or produced from it. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, or Google Sheets API integration.4license: Proprietary. LICENSE.txt has complete terms5---67# Requirements for Outputs89## All Excel files1011### Professional Font1213- Use a consistent, professional font (e.g., Arial, Times New Roman) for all deliverables unless otherwise instructed by the user1415### Zero Formula Errors1617- Every Excel model MUST be delivered with ZERO formula errors (#REF!, #DIV/0!, #VALUE!, #N/A, #NAME?)1819### Preserve Existing Templates (when updating templates)2021- Study and EXACTLY match existing format, style, and conventions when modifying files22- Never impose standardized formatting on files with established patterns23- Existing template conventions ALWAYS override these guidelines2425## Financial models2627### Color Coding Standards2829Unless otherwise stated by the user or existing template3031- **Blue text (RGB: 0,0,255)**: Hardcoded inputs, and numbers users will change for scenarios32- **Black text (RGB: 0,0,0)**: ALL formulas and calculations33- **Green text (RGB: 0,128,0)**: Links pulling from other worksheets within same workbook34- **Red text (RGB: 255,0,0)**: External links to other files35- **Yellow background (RGB: 255,255,0)**: Key assumptions needing attention or cells that need to be updated3637### Number Formatting Standards3839- **Years**: Format as text strings (e.g., "2024" not "2,024")40- **Currency**: Use $#,##0 format; ALWAYS specify units in headers ("Revenue ($mm)")41- **Zeros**: Use number formatting to make all zeros "-", including percentages (e.g., "$#,##0;($#,##0);-")42- **Percentages**: Default to 0.0% format (one decimal)43- **Multiples**: Format as 0.0x for valuation multiples (EV/EBITDA, P/E)44- **Negative numbers**: Use parentheses (123) not minus -1234546### Formula Construction Rules4748- Place ALL assumptions in separate assumption cells49- Use cell references instead of hardcoded values in formulas50- Example: Use =B5\*(1+$B$6) instead of =B5\*1.055152## XLSX creation, editing, and analysis5354### Overview5556A user may ask you to create, edit, or analyze the contents of an .xlsx file.5758### Reading and analyzing data5960```python61import pandas as pd6263df = pd.read_excel("file.xlsx")64all_sheets = pd.read_excel("file.xlsx", sheet_name=None)65```6667### CRITICAL: Use Formulas, Not Hardcoded Values6869**Always use Excel formulas instead of calculating values in Python and hardcoding them.**7071#### ❌ WRONG7273```python74total = df["Sales"].sum()75sheet["B10"] = total # Hardcodes 500076```7778#### ✅ CORRECT7980```python81sheet["B10"] = "=SUM(B2:B9)"82```8384### Common Workflow85861. **Choose tool**: pandas for data, openpyxl for formulas/formatting872. **Create/Load**: Create new workbook or load existing file883. **Modify**: Add/edit data, formulas, and formatting894. **Save**: Write to file905. **Recalculate formulas (MANDATORY IF USING FORMULAS)**:9192 ```bash93 python scripts/recalc.py output.xlsx94 ```95966. **Verify and fix any errors**9798#### Creating new Excel files99100```python101from openpyxl import Workbook102from openpyxl.styles import Font, PatternFill, Alignment103104wb = Workbook()105sheet = wb.active106sheet["A1"] = "Hello"107sheet["B1"] = "World"108sheet["B2"] = "=SUM(A1:A10)"109sheet["A1"].font = Font(bold=True, color="FF0000")110wb.save("output.xlsx")111```112113#### Editing existing Excel files114115```python116from openpyxl import load_workbook117118wb = load_workbook("existing.xlsx")119sheet = wb.active120sheet["A1"] = "New Value"121wb.save("modified.xlsx")122```123124### Recalculating formulas125126```bash127python scripts/recalc.py <excel_file> [timeout_seconds]128```129130The script:131132- Automatically sets up LibreOffice macro on first run133- Recalculates all formulas in all sheets134- Scans ALL cells for Excel errors135- Returns JSON with detailed error locations and counts136137### Formula Verification Checklist138139- [ ] **Test 2-3 sample references**: Verify they pull correct values140- [ ] **Column mapping**: Confirm Excel columns match (e.g., column 64 = BL)141- [ ] **Row offset**: Excel rows are 1-indexed (DataFrame row 5 = Excel row 6)142- [ ] **NaN handling**: Check for null values with `pd.notna()`143- [ ] **Division by zero**: Check denominators before using `/`144145### Best Practices146147#### Library Selection148149- **pandas**: Best for data analysis, bulk operations, and simple data export150- **openpyxl**: Best for complex formatting, formulas, and Excel-specific features151152#### Working with openpyxl153154- Cell indices are 1-based155- Use `data_only=True` to read calculated values156- **Warning**: If opened with `data_only=True` and saved, formulas are permanently lost157- Formulas are preserved but not evaluated — use `scripts/recalc.py` to update values158159### Code Style Guidelines160161- Write minimal, concise Python code without unnecessary comments162- Avoid verbose variable names and redundant operations163- For Excel files: add comments to cells with complex formulas, document data sources for hardcoded values164165### Dependencies166167- **pandas**: Data analysis and manipulation168- **openpyxl**: Excel file creation and editing with formulas/formatting169- **LibreOffice**: Formula recalculation (via `scripts/soffice.py`)