by @anthropic
A comprehensive spreadsheet skill using openpyxl and pandas. Create professional Excel files with proper formatting, formulas, color coding, and financial model standards. Read, edit, and analyze existing spreadsheets with data manipulation and visualization.
Use this skill any time a spreadsheet file is the primary input or output: opening, reading, editing, creating .xlsx/.csv/.tsv files, adding columns, computing formulas, formatting, charting, or cleaning messy data.
import pandas as pd
df = pd.read_excel('file.xlsx')
all_sheets = pd.read_excel('file.xlsx', sheet_name=None)
df.head()
df.info()
df.describe()
df.to_excel('output.xlsx', index=False)
Always use Excel formulas instead of calculating in Python and hardcoding them.
total = df['Sales'].sum()
sheet['B10'] = total # Hardcodes 5000
sheet['B10'] = '=SUM(B2:B9)'
sheet['C5'] = '=(C4-C2)/C2'
sheet['D20'] = '=AVERAGE(D2:D19)'