Skip to content

Show a merged cell as merged — its value stops at the top-left square today, leaving blank runs that reader and assistant both read as empty #170

Closed

Description

@bencode

Problem

A merged cell states a structure — a grouped header spanning Q1 across three columns, a category label owning its block of rows — and that structure disappears on the way in, for reader and assistant alike:

  • read-excel-file never parses it: the merged-cell branch is left as a comment in its sheet parser ("it could also parse merged cells… But then it's not clear what should be the way to return such merged cells", read-excel-file@9.3.10 modules/xlsx/parseSheet.js:343-351), so every cell outside the merge's top-left comes back null.
  • readSpreadsheet carries no way to know (ui-packages/web/src/formats/xlsx.ts:4, Worksheet = { name, rows }), and the boundary drops the workbook's own <mergeCells> record without looking.
  • The grid renders each cell as it comes (sheet-grid.tsx:89, cellText(rows[i][j])), so a merged header shows one label followed by a run of blank squares — indistinguishable from a half-empty sheet.
  • The agent reads the same blanks: sheetText (xlsx.ts:80) turns each null into an empty tab-separated field, so asking about the columns under that header, the model cannot tell a merged continuation from a genuinely empty cell.

Merged headers are standard in forms, financial layouts and grouped reports — the very documents a reader brings to check against. Both surfaces misstate the sheet in the same direction, and neither says anything is missing.

Proposal

Goal

After this, a grouped header shows as grouped in the preview and sheet_read/sheetText say which cells a merge covers, so no merged cell reads as a blank in either surface, and reader and assistant agree on the sheet's structure.

Verification

# fixture workbook with a merged header row (e.g. B2:D2 merged as "Q1");
# the grid shows one spanning cell and sheetText states the merge, not blanks
grep -rqiE "merge" ui-packages/web/src/formats/xlsx.ts ui-packages/web/src/features/reader/xlsx-reader/sheet-grid.tsx
cd ui-packages/web && pnpm vitest run --project unit src/formats/xlsx.test.ts

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 22, 2026
  2. bencode commented on Oct 22, 2026

    @bencode
    OwnerAuthor

    Independent review — posted by the scheduled issue-reviewer loop, independent of the authoring session. Audited against main@ebb0ee0.

    Evidence audit: all citations confirmed, including the upstream library quote.

    Duplicate check: none — #161 loses the value's scale, #157 its errors, this one its shape; three orthogonal losses in one theme, correctly cross-referenced as siblings. Nothing open or closed covers merged cells.

    Verification block repaired (logged here per policy): the block ran only the existing xlsx.test.ts, which passes on unmodified main — verify reported "implemented" with nothing implemented (the #157/#158/#167/#169 disease in false-pass form; the fixture description is a comment, invisible to the gate). Prepended:

    grep -rqiE "merge" ui-packages/web/src/formats/xlsx.ts ui-packages/web/src/features/reader/xlsx-reader/sheet-grid.tsx

    Zero matches today ✓; any implementation must speak of merges on the format boundary or the grid. Re-linted ✓; verify now correctly fails on main ✓.

    Verdict: valid, keep open. The two-surface claim (reader and assistant misread alike) is verified both directions. Sharpening: the fixture is the load-bearing half — build it first (a workbook whose header is B2:D2 merged as "Q1"), and decide sheetText's agent-facing convention deliberately: repeating the anchor value in continuation cells is machine-friendlier than a marker string and matches what parseSheet.js's maintainer mused about; whichever is chosen, the grid and sheetText must agree, or reader and agent will trade one disagreement for another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions