working-with-spreadsheetslisted
Install: claude install-skill aiskillstore/marketplace
# Working with Spreadsheets
## Quick Start
```python
from openpyxl import Workbook
wb = Workbook()
sheet = wb.active
sheet['A1'] = 'Revenue'
sheet['B1'] = 1000
sheet['B2'] = '=B1*1.1' # Use formulas, not hardcoded values!
wb.save('output.xlsx')
```
## Critical Rule: Use Formulas, Not Hardcoded Values
**Always use Excel formulas instead of calculating in Python.**
```python
# WRONG - Hardcoding calculated values
total = df['Sales'].sum()
sheet['B10'] = total # Hardcodes 5000
# CORRECT - Using Excel formulas
sheet['B10'] = '=SUM(B2:B9)'
```
## Financial Model Color Coding Standards
| Color | RGB | Usage |
|-------|-----|-------|
| **Blue text** | 0,0,255 | Hardcoded inputs, scenario values |
| **Black text** | 0,0,0 | ALL formulas and calculations |
| **Green text** | 0,128,0 | Links from other worksheets |
| **Red text** | 255,0,0 | External links to other files |
| **Yellow background** | 255,255,0 | Key assumptions needing attention |
```python
from openpyxl.styles import Font
# Input cell (user changeable)
sheet['B5'].font = Font(color='0000FF') # Blue
# Formula cell
sheet['C5'] = '=B5*1.1'
sheet['C5'].font = Font(color='000000') # Black
# Cross-sheet link
sheet['D5'] = "=Sheet2!A1"
sheet['D5'].font = Font(color='008000') # Green
```
## Number Formatting Standards
```python
# Currency with thousands separator
sheet['B5'].number_format = '$#,##0'
# Zeros display as dash
sheet['B5'].number_format