openpyxl-merged-cell-safe-write

Installation
SKILL.md

OpenPyXL Merged Cell Safe Write Pattern

Problem

When creating formatted spreadsheets with openpyxl, merging cells and then assigning values to them causes MergedCell errors. This is a common pitfall that can consume multiple failed iterations.

Core Rule

Always assign values to the top-left cell of a merge range BEFORE applying the merge, or avoid assigning to merged cells entirely after the merge is applied.

Correct Pattern

from openpyxl import Workbook

wb = Workbook()
ws = wb.active
Installs
1
Repository
hkuds/openspace
GitHub Stars
7.7K
First Seen
Jun 1, 2026
openpyxl-merged-cell-safe-write — hkuds/openspace