xlsxpython

xlsx merged header create skill

xlsx_merged_header_create_rungs: creates a new .xlsx workbook with a genuinely merged cell (via openpyxl's own merge, verified as a real merged range on reload) holding the given header text, plus any number of other ordinary cells set to their own values, with everything else left empty. Writing to any cell inside a merged range other than its top-left raises AttributeError in openpyxl once merged; the helper writes the top-left value before merging and never touches another covered cell.

rec_c8bb1b1f87124918b6c8e997af958205 · banked 2026-09-05 · by neruva
SKILL.md
Certificate

A program checked this on cases it had never seen. You can run it.

Download the checker
Model alone
see evidence
With this skill
see evidence
Near-misses it rejects
5/5
Signed
no
What was checked
  • Output built to the specification is accepted.
  • Each of these deliberate breaks is rejected: truncated_file, no_real_merge, wrong_top_left, wrong_single, stray_value.
  • An empty file is rejected.
What was not
  • Anything a person would call taste: layout, tone, whether it looks good. No program can check that, and this one does not claim to.
  • Behaviour outside the specification's clauses.
  • Inputs the checker was never given. See the evidence line for the corpus.

Evidence

  • held-out 3 of 5 specs, agent-executed (no separate model, $0): 3/3 passed a gated two-sided-contract checker (variants 2/2 accepted, spoilers 5/5 rejected on the named clause, cross-spec 12/12 rejected)
  • cold naive creation (repeat the header text into every cell of the range instead of a real merge) failed 5/5, always on the same clause: no real merged range was ever created.
  • one-call schema flattened after live testing with a local Qwen3-0.6B: the original schema used a nested list-of-pairs for `cells` and the model never produced it correctly (3/3 malformed or unparseable); a flat JSON object keyed 'row,col' fixed the JSON-structure problem completely (3/3 clean, well-typed JSON). Remaining failures on that same model are a genuine reasoning limit, not a schema defect: it reliably sets merge_end_row equal to merge_end_col regardless of instruction, even when told explicitly not to touch other rows -- reported honestly rather than tuned away.

Use it

# in Claude Code (MCP tools from neruva-mcp)
rung_search(q="xlsx_merged_header_create_rungs")
rung_install(id="rec_c8bb1b1f87124918b6c8e997af958205", dir="~/.claude/skills")
# the skill folder is now loaded like any other skill

Usage guide

What the model reads to call the skill. This is the whole interface.

Show the guide
make_merged_sheet(header: str, merge_range: tuple, cells: dict, out_path: str) -> None
    Creates a new .xlsx with ONE merged header cell and writes it to out_path.

    header       the text the merged cell should show
    merge_range  ((r0, c0), (r1, c1)) -- 0-indexed, inclusive, the rectangle to merge
    cells        {(r, c): value} for every other cell to set, also 0-indexed
    out_path     where to save the workbook

    IMPORTANT: never write to a cell inside merge_range other than (r0, c0) -- openpyxl
    raises AttributeError on that, because every other cell in a merged range becomes a
    read-only MergedCell object once merged.

Example:
    make_merged_sheet("SUMMARY", ((0, 0), (0, 2)),
                      {(1, 0): "Region", (1, 1): "Rep", (1, 2): "Total"},
                      "/tmp/report.xlsx")

Code

19 lines of python, hashed and signed below.

Show the code
"""Create an .xlsx with a real merged header cell (openpyxl's own merge, not repeated
text). Writing to any cell in a merged range OTHER than its top-left raises AttributeError
-- verified empirically -- so the top-left value must be written before merging, and no
other covered cell is ever touched afterwards."""


def make_merged_sheet(header: str, merge_range: tuple, cells: dict, out_path: str) -> None:
    """merge_range: ((r0,c0),(r1,c1)), 0-indexed inclusive. cells: {(r,c): value} for
    every other cell to set, also 0-indexed. Writes the workbook to out_path."""
    from openpyxl import Workbook
    wb = Workbook()
    ws = wb.active
    (r0, c0), (r1, c1) = merge_range
    ws.cell(row=r0 + 1, column=c0 + 1).value = header
    ws.merge_cells(start_row=r0 + 1, start_column=c0 + 1, end_row=r1 + 1, end_column=c1 + 1)
    for (r, c), v in cells.items():
        ws.cell(row=r + 1, column=c + 1).value = v
    wb.save(out_path)

Certificate

Code sha256 8e696386c6ce4a3b3c66397b46ad589158ce7d2bcaa69ace26108e68682e4994
Signature none