← Back to Pull requests

feat(utils): read the sheets of an xlsx workbook #1962

Closed
unknown closed this pull request without merging on Nov 22, 2026 20:25 UTC
View on GitHub
unknown unknown commented on Nov 22, 2026 20:14 UTC
Author

Overview

Step 1 of the plan for #1957 and #1958: a module that reads the sheets of an xlsx workbook.

The gviz CSV download guesses header rows (#1957) and empties a cell whose type differs from its column (#1958). The xlsx export of the whole spreadsheet has neither problem. The new Xlsx.read takes the workbook bytes and returns the rows of every sheet by name:

  • It finds the workbook, shared strings and sheets through the package relationships, starting at _rels/.rels.

  • Each cell keeps its own type, so a number stored as text keeps its value.

  • Rows hidden by a filter and empty rows are left out, and cells are trimmed, as the readers get them now.

  • A number is written as a plain decimal with at most 15 significant digits. A boolean is TRUE or FALSE. An error cell, such as #N/A, is empty.
  • Nothing calls the module yet. Step 2 switches the sheet download to the workbook and closes both issues.

    Further information

  • Xlsx.fs uses only System.IO.Compression and System.Xml.Linq. It reads from bytes in memory, which is why the dependency rule check gets an allowance for System.IO.

  • The step 2 prototype, Scripts/Issue1957SheetWorkbook.fsx, is included. The step 2 pull request deletes it.
  • Divergence from plan

    None.

    Verification

  • 45 new tests in tests/Informedica.Utils.Tests build the workbook in memory. They cover a header without a dummy row, a number stored as text, small numbers, numbers, booleans, inline and formula strings, error cells, hidden and empty rows, an empty formatted cell far beyond the data, a workbook in another folder, a missing _rels/.rels or workbook, and bytes that are not a workbook. All 413 Utils tests pass.

  • dotnet fsi Issue1957SheetWorkbook.fsx --live compares the new read of the production workbook with the gviz download of the 21 sheets the code reads. The only differences are the 44 cells the gviz download lost and 11 cells that now have more digits.

  • The dependency rule check and Fantomas pass.
  • Author checklist

    [!NOTE]

    An issue and agreed implementation plan are necessary unless either fewer than 25 source lines have been changed or only documentation has been changed. Source lines are the changed lines of the shipped code under src/; tests, prototype scripts, documentation and lock files are not counted (see [CONTRIBUTING.md](../../CONTRIBUTING.md#steps)).

    I confirm that these changes:

  • Follow the process described in [CONTRIBUTING.md](../../CONTRIBUTING.md#pull-request-process).

  • Make the changes proposed in the linked issue (if applicable): part of #1957 and #1958

  • Follow the approach documented in the linked implementation plan (if applicable): docs/implementation-plans/1957-1958-read-the-sheets-from-the-workbook.md, step 1

  • Are no more than 200 changed source lines, ideally 25-100. 223 lines: Xlsx.fs (222) and the project file (1). The module is one unit and was not compressed to fit.

  • Are not more complex than necessary.

  • Cannot easily be split in a way that would make reviewing them significantly easier.

  • Follow the guidelines specified in [DEVELOPMENT.md](../../DEVELOPMENT.md).

  • Have been thoroughly tested.

  • Don't introduce new security vulnerabilities.

  • Follow the script-first policy in [AGENTS.md](../../AGENTS.md): source changes migrate a script that passes its tests and was reviewed, except the changes the policy allows without a script.
  • AI/Vibe Coding Disclosure

  • Some or all code in this PR is vibe coded (substantially AI-generated). If checked, describe below which parts were AI-generated, which tool was used, and how the code was verified.
  • The module, tests and plan were written with Claude Code (Claude Opus 5.5), prototyped in a script, and reviewed before migration. They were checked with the unit tests and with the comparison against the production workbook.

    I confirm that I have:

  • Added appropriate automated tests.

  • Updated documentation appropriately.

  • Added comments that highlight important changes and add justification, where necessary. (Create the PR as a draft first, add your comments, then mark as ready for review.)
  • Reviewer checklist

    I confirm that:

  • I am confident that the changes work.

  • The changed code meets our guidelines and standards.

  • The new code is not more complex than necessary.

  • I have clearly labeled suggestions as blocking, required but not blocking, or optional (see [CONTRIBUTING.md](../../CONTRIBUTING.md#pull-request-process)).
  • 🤖 Generated with Claude Code

    Diff: 611 lines (+458 / -153) across 7 files Reviewer: greptile-apps[bot] Review duration: 10m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.50) × (1 − Review Confidence (0.53)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 611 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 71% · Reviewer familiarity: 35%
    53%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.384
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1962"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 53.4% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.2% (MEDIUM) · Higher = larger blast radius
    50.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 53.4% · Lower = rushed or shallow review
    53.4%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.4% · Safe to merge
    23.4%