--- name: xlsx_merged_header_create_rungs description: "Create a new spreadsheet with a real merged header cell over a range of columns or rows, so it actually looks and behaves merged when opened, not just repeated text in every cell. xlsx_merged_header_create_rungs: xlsx_merged_header_create_rungs: creates a new .xlsx workbook with a genuinely merged c" --- # xlsx_merged_header_create_rungs (a Neruva verified skill for `xlsx`) Create a new spreadsheet with a real merged header cell over a range of columns or rows, so it actually looks and behaves merged when opened, not just repeated text in every cell. Verified helper code for `xlsx`, python. Entry points: `make_merged_sheet`. Code hash sha256 `8e696386c6ce4a3b3c66397b46ad589158ce7d2bcaa69ace26108e68682e4994`, unsigned. Banked by `legacy-dev`. ## One call Call `build(**args)` with an object matching this schema. You do not have to write code or match the helper signatures below. ```json { "type": "object", "properties": { "header": { "type": "string", "description": "Text the merged cell should show" }, "merge_start_row": { "type": "integer", "description": "0-indexed" }, "merge_start_col": { "type": "integer", "description": "0-indexed" }, "merge_end_row": { "type": "integer", "description": "0-indexed, inclusive" }, "merge_end_col": { "type": "integer", "description": "0-indexed, inclusive" }, "cells": { "type": "object", "description": "Map of 'row,col' (0-indexed) to the value for every other cell to set" }, "output_path": { "type": "string", "description": "Where to save the .xlsx" } }, "required": [ "header", "merge_start_row", "merge_start_col", "merge_end_row", "merge_end_col", "cells", "output_path" ] } ``` Example arguments: ```json { "header": "SUMMARY", "merge_start_row": 0, "merge_start_col": 0, "merge_end_row": 0, "merge_end_col": 2, "cells": { "1,0": "Region", "1,1": "Rep", "1,2": "Total" }, "output_path": "/tmp/report.xlsx" } ``` ```python def build(header, merge_start_row, merge_start_col, merge_end_row, merge_end_col, cells, output_path): parsed_cells = {} for k, v in cells.items(): r, c = k.split(',') parsed_cells[(int(r), int(c))] = v make_merged_sheet(header, ((merge_start_row, merge_start_col), (merge_end_row, merge_end_col)), parsed_cells, output_path) return {"path": output_path} ``` ## How to use it 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") ## Evidence (corpus named) - 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. ## Files - `scripts/skill.py`: the verified code (GET /v1/commons/rungs/rec_c8bb1b1f87124918b6c8e997af958205/code) - verify: POST /v1/commons/verify {"id": "rec_c8bb1b1f87124918b6c8e997af958205"}