exceljs / exceljs/exceljs

[BUG] replacement character (�) seems randomly on WorkbookReader with fileStream.

Open
#2,316 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.5k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug Report

Lib version: 4.3.0

Hello.
I'm using streams to load Excel data, and the replacement character (� - displayed as a black rhombus with a white question mark) appears in the middle of the text, about one in 2,000 lines.

I tried everything I could, but I couldn't find a solution.

## Steps To Reproduce

When I re-upload and test the same file, the character does not appear or occurs in a different location.
Therefore, general reproduction is difficult.
Below is the code I'm using.

```javascript
const fileStream = await getFileStreamSync({
key: excelFileS3ObjectKey,
});
const workbookReader = new Excel.stream.xlsx.WorkbookReader(fileStream, {
sharedStrings: 'cache',
styles: 'cache',
});

let readDataFromExcelStream;
for await (const worksheetReader of workbookReader) { // eslint-disable-line semi
if (worksheetReader.name === 'sheet1') {
readDataFromExcelStream = await createReadableStreamFromWorksheetReader({
worksheetReader,
invalidDataRowList,
});
}
}

pipeline(readDataFromExcelStream, ...);
```

Reading data in `createReadableStreamFromWorksheetReader`
```javascript
for await (const row of worksheetReader) {
row.eachCell((cell, cellNumber) => {
const cellName = profileCardExcelItemKeyList[cellNumber - 1];
data = {
...data,
[cellName]: getCellValue(cell.value, cell.style),
};
});
}
```

## The expected behaviour:

Loading normally without replacement character.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.