Editing Excel Files with openpyxl (Preserve Formatting)

SkillFiles & storage

Editing existing Excel files with openpyxl while preserving formatting and adding formulas.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Editing Excel Files with openpyxl (Preserve Formatting) skill

What this skill tells your AI

The instructions your AI receives, as published by cxcscmu/skilllearnbench in skills/b1-one-shot-claude-opus-4-6/weighted-gdp-calculation/openpyxl-formula-editing/SKILL.md and read by ahel’s review.

Load and Edit

from openpyxl import load_workbook

wb = load_workbook('file.xlsx')
ws = wb['SheetName']

# Write formula to a cell (preserves existing formatting)
ws['H12'] = '=SOME_FORMULA()'

# Iterate over a range
for row in range(12, 18):
    for col_letter in ['H', 'I', 'J', 'K', 'L']:
        ws[f'{col_letter}{row}'] = f'=FORMULA({col_letter}...)'

wb.save('file.xlsx')

Important Notes

  • Assigning a value to a cell preserves its existing formatting (fill, font, borders)
  • Formulas are stored as strings starting with '='
  • Use recalc.py after saving to compute formula values
  • Never open with data_only=True if you plan to save (destroys formulas)

Signals

GitHub stars
83
Forks
5
Last commit
Jul 2026
Advanced
Catalog kind
skill
Gateway key
openpyxl-formula-editing
Source
github.com/cxcscmu/skilllearnbench