Skip to content

Let a workbook with a chart sheet open — today it fails whole as 'This workbook could not be read. Only .xlsx files are supported', a false claim about a file Excel itself wrote #243

Closed

Description

@bencode

Problem

A workbook with a chart sheet — what Excel's own Insert → Chart Sheet writes — cannot be opened at all, by the reader or the assistant. Verified against a two-sheet workbook whose second sheet is a chart sheet: readSpreadsheet throws TypeError: Cannot read properties of undefined (reading 'map'), while the same workbook without the chart sheet parses fine.

The chain: read-excel-file maps only worksheet-type relationships, so it returns the chart sheet as an entry with data: undefined; the repo's readSheetDetails maps every relationship and hands the chart sheet's name a real (empty) details object (ui-packages/web/src/formats/xlsx-package.ts:42-58), so the if (!details) return { name, rows } guard in withDetails never fires and rows.map runs on undefined (ui-packages/web/src/formats/xlsx.ts:136-149).

What the reader meets is the catch-all: "This workbook could not be read. Only .xlsx files are supported." (ui-packages/web/src/features/reader/xlsx-reader/index.tsx:21-31) — a false statement about a file Excel itself wrote, with every data sheet lost behind it. The assistant fails the same way: readSpreadsheet throws inside load, so every sheet tool and read fails for the whole workbook (ui-packages/web/src/features/assistant/xlsx/runtime.ts:24-34).

A lesser member of the same gap: a chart placed on a normal worksheet parses fine but vanishes without a marker — the grid and the agent's workbookText (ui-packages/web/src/formats/xlsx.ts:89-102) say nothing about it, while a chart inside a Word document already gets "(Chart not converted)" (ui-packages/web/src/formats/docx-unconverted.ts:59-74).

Proposal

  • Carry a chart sheet through as a sheet with no cells: its name reaches the sheet tabs, its grid says it holds a chart rather than pretending to be empty, and the workbook's data sheets open as usual.
  • Repair the failure message this exposed: a parse failure inside the app must not claim the format is unsupported ("Only .xlsx files are supported") for a .xlsx the store accepted.
  • Name embedded charts where they sit: the details reader already walks the sheet parts, so a chart anchored to a worksheet can be reported — at least in the agent's text view — the way Word conversion marks its charts.

Goal

After this, a workbook with a chart sheet opens to its data sheets for reader and assistant alike, the chart sheet itself is identified as a chart instead of sinking the file, and a chart on a worksheet is at least named to both reader and assistant rather than silently gone.

Verification

pnpm --filter @gamma-reader/web test src/formats
grep -rn "chart" ui-packages/web/src/formats/xlsx-package.ts
pnpm check

Refs

Activity

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

    @bencode
    OwnerAuthor

    Review — posted by the scheduled issue-reviewer loop (independent of the authoring session), against main@e8c930f.

    Evidence audit: every citation holds, and the crash chain traced end-to-end into the dependency source.

    • ✅ formats/xlsx-package.ts:42-58 — sheetPaths maps every <sheet> in workbook.xml with no relationship-type filter; readSheetDetails (:112-119) returns a real {cells: [], merges: []} even when a part fails to parse — so the chart sheet's name always has truthy details.
    • ✅ formats/xlsx.ts:136-149 — withDetails's if (!details) return { name, rows } guard can therefore never fire; rows.map runs. ✅ xlsx.ts:151-159 — readSpreadsheet passes sheet.data as SheetRow[] straight through (the cast hides the undefined).
    • ✅ Dependency confirmed: read-excel-file@9.3.10 parseFilePaths.js records only worksheet-type relationships, and parseSpreadsheetContents.js emits {sheet, data: sheetsData[rId]} — a chart sheet arrives as {data: undefined} → TypeError: Cannot read properties of undefined (reading 'map'), exactly as reported.
    • ✅ xlsx-reader/index.tsx:21-31 — the false "Only .xlsx files are supported." catch-all; ✅ assistant/xlsx/runtime.ts:24-34 — the same throw fails every assistant path; ✅ docx-unconverted.ts:60 — the 'Chart' marker precedent.
    • 🔁 One drifted anchor: workbookText sits at xlsx.ts:132, not the cited :89-102 (that range is sheetText). Behavior claim holds — no chart word anywhere in the sheet views.

    Duplicate check: nothing open or closed covers chart sheets or the false unsupported-format message; #210 (cell notes, closed) and #69 (in-sheet search) are the xlsx family, not overlaps.

    Sensor: lint ✓; verify ✗ → not implemented (formats tests pass 30/30 today; the grep -rn "chart" xlsx-package.ts step is the failing gate, zero matches). pnpm check still fails on unmodified main (conversation-panel.integration.test.tsx, deterministic — flagged last beat, still open), which blocks any close path regardless.

    Verdict: valid, keep open. One sharpening: step 1 (test src/formats) already passes on unmodified main, and a bare chart grep could be satisfied by the embedded-chart marker while the crash remains — anchor the load-bearing deliverable instead, e.g. a formats test named for chartsheets (--testNamePattern="chart") that parses a workbook whose second sheet is a chartsheet; it fails today and passes only when the whole file stops sinking.

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