excel-unmerge-before-write

excel-unmerge-before-write is a skill for Claude Code, Codex from HKUDS/OpenSpace. It costs 22 tokens per session (777 once invoked), scanned A, original, MIT.

A safe pattern for filling Excel templates with Python's openpyxl library when the worksheet contains merged cells. Merged cells combine several spreadsheet cells into one displayed area, and only the top-left cell can normally receive a value.

In plain words
What is it for?
Use it to inspect merged ranges, unmerge those overlapping the cells you need to populate, write the values, and save the completed workbook.
Why use it?
It prevents write errors caused by trying to place values into the protected parts of merged ranges.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect merged ranges, unmerge those overlapping the cells you need to populate, write the values, and save the completed workbook.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hkuds/openspace/excel-unmerge-before-write
About the project

OpenSpace is a skill-management layer for AI agents that stores, retrieves, evaluates, shares, and improves reusable workflows. It is intended for people using multiple coding agents who want skills to be reused and refined based on task outcomes. The catalogue provides 200 skills for use with OpenSpace and the agents it supports.

HKUDS/OpenSpace · 7,544 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add HKUDS/OpenSpace --skill excel-unmerge-before-write
Clone the repo
git clone --depth 1 https://github.com/HKUDS/OpenSpace

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for excel-unmerge-before-write

README.md
[![agentmods](https://agentmods.dev/badge/skills/hkuds/openspace/excel-unmerge-before-write.svg)](https://agentmods.dev/skills/hkuds/openspace/excel-unmerge-before-write)
Your own site
<a href="https://agentmods.dev/skills/hkuds/openspace/excel-unmerge-before-write"><img src="https://agentmods.dev/badge/skills/hkuds/openspace/excel-unmerge-before-write.svg" alt="Measured on agentmods" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 777 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00022 $0.00777
Opus 5 $0.00011 $0.00388
Sonnet 5 $0.00004 $0.00155
Haiku 4.5 $0.00002 $0.00078

Measured 8d ago against content hash 8463964f1fbf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

excel-unmerge-before-write scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

benchmarks/gdpval/skills/excel-unmerge-before-write/SKILL.md · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Excel Unmerge Before Write

When automating Excel file population with openpyxl, merged cells in templates can cause write failures. This skill provides the pattern to safely handle merged ranges before populating data.

When to Use

  • Working with Excel templates that have pre-existing merged cells
  • Getting AttributeError when trying to write values to certain cells
  • Needing to populate data in areas that may contain merged ranges

Core Pattern

Before writing values to cells in a worksheet, identify and unmerge any overlapping ranges:

from openpyxl import load_workbook

# Load the workbook
wb = load_workbook('template.xlsx')
ws = wb.active

# Unmerge specific ranges before writing
ws.unmerge_cells('A46:C46')
ws.unmerge_cells('E46:F46')
ws.unmerge_cells('I46:K46')

# Now safely write values
ws['A46'] = 'Value 1'
ws['E46'] = 'Value 2'
ws['I46'] = 'Value 3'

wb.save('output.xlsx')

Step-by-Step Instructions

  1. Identify merged ranges in your target worksheet:

    print(ws.merged_cells.ranges)
    
  2. Unmerge relevant ranges before writing any data to those areas:

    for merged_range in ws.merged_cells.ranges:
        # Optionally filter by area if you only need specific ranges
        ws.unmerge_cells(str(merged_range))
    
  3. Write your data to the now-unmerged cells:

    ws.cell(row=46, column=1, value='Your data')
    
  4. Save the workbook:

    wb.save('output.xlsx')
    

Handling Multiple Worksheets

If your workbook has multiple sheets with merged cells:

for sheet_name in wb.sheetnames:
    ws = wb[sheet_name]
    for merged_range in list(ws.merged_cells.ranges):
        ws.unmerge_cells(str(merged_range))

Common Errors

Error Cause Solution
AttributeError on cell write Writing to merged cell Call unmerge_cells() first
KeyError on range Invalid range string Use exact range format like 'A1:B2'
Data overwrites neighbors Unmerged too broadly Unmerge only needed ranges

Read the full file on GitHub · 110 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 110 lines · 22 tokens per session scan A 8463964f1fbf

Subscribe to this mod's changes

excel-unmerge-before-write is a skill published in the GitHub repository HKUDS/OpenSpace (7,544 stars, last pushed 26d ago), licensed MIT. It adds 22 tokens to every session and 777 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.