agentsclimarketplace

Openpyxl formula editing

Skill cxcscmu/SkillLearnBench/skills/b1-one-shot-claude-opus-4-6/weighted-gdp-calculation/openpyxl-formula-editing

Editing existing Excel files with openpyxl while preserving formatting and adding formulas.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill openpyxl-formula-editing

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

0.9 KB, 204 tokens by cl100k_base, as published. Nobody here has run it

Editing Excel Files with openpyxl (Preserve Formatting)

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)

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.