Skip to content

Adopt upstream PR #2915: Fix WorkbookReader sharedString parsing #21

@protobi-pieter

Description

@protobi-pieter

Summary

Adopt upstream PR exceljs#2915 to fix an issue where WorkbookReader sometimes returns sharedString indices instead of actual cell values.

This fixes a data corruption issue in streaming reads where shared string values are not properly resolved, causing cells to display numbers (sharedString indices) instead of their actual text content.

Upstream PR

Changes

File modified:

  • lib/stream/xlsx/workbook-reader.js - Fix stream piping for sharedString resolution (2 additions, 3 deletions)

Total: 2 additions, 3 deletions

Bug Description

When using WorkbookReader to stream-read Excel files, cell values that reference shared strings are sometimes returned as numeric indices instead of the actual string values. This causes data corruption in parsed worksheets.

Current behavior:

const zip = unzip.Parse({forceStream: true});
stream.pipe(zip);
// ...
for await (const entry of iterateStream(zip)) {
  // Processing happens with incorrect stream handling
}

Fixed behavior:

const zip = stream.pipe(unzip.Parse({forceStream: true}));
// ...
for await (const entry of zip) {
  // Proper stream handling ensures sharedString resolution
}

Value Proposition

  • Low Risk - Simple stream handling fix
  • Bug Fix - Prevents data corruption in streaming reads
  • User Impact - Fixes intermittent issue affecting production data

Testing Plan

  • Apply changes from upstream PR
  • Run existing test suite
  • Verify WorkbookReader properly resolves sharedString values
  • Test with files containing shared strings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions