question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Regression] Stream API fails to write XLSX files

See original GitHub issue

Since version 0.2.10, exceljs fails to write xlsx files using the stream API with the following error:

Unhandled rejection Error: append: input source must be valid Stream or Buffer instance
    at Archiver.append (/home/bugreport/backend/node_modules/archiver/lib/core.js:333:24)
    at /home/bugreport/backend/node_modules/exceljs/lib/stream/xlsx/workbook-writer.js:251:18
    at Promise._execute (/home/bugreport/backend/node_modules/bluebird/js/release/debuggability.js:272:9)
    at Promise._resolveFromExecutor (/home/bugreport/backend/node_modules/bluebird/js/release/promise.js:475:18)
    at new Promise (/home/bugreport/backend/node_modules/bluebird/js/release/promise.js:77:14)
    at Object.WorkbookWriter.addSharedStrings (/home/bugreport/backend/node_modules/exceljs/lib/stream/xlsx/workbook-writer.js:250:14)
    at /home/bugreport/backend/node_modules/exceljs/lib/stream/xlsx/workbook-writer.js:131:16
    at tryCatcher (/home/bugreport/backend/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/bugreport/backend/node_modules/bluebird/js/release/promise.js:504:31)
    at Promise._settlePromise (/home/bugreport/backend/node_modules/bluebird/js/release/promise.js:561:18)
    at Promise._settlePromise0 (/home/bugreport/backend/node_modules/bluebird/js/release/promise.js:606:10)
    at Promise._settlePromises (/home/bugreport/backend/node_modules/bluebird/js/release/promise.js:685:18)
    at Promise._fulfill (/home/bugreport/backend/node_modules/bluebird/js/release/promise.js:630:18)
    at Promise._resolveCallback (/home/bugreport/backend/node_modules/bluebird/js/release/promise.js:447:14)
    at Promise._settlePromiseFromHandler (/home/bugreport/backend/node_modules/bluebird/js/release/promise.js:516:17)
    at Promise._settlePromise (/home/bugreport/backend/node_modules/bluebird/js/release/promise.js:561:18)

This is the code to reproduce the problem:

const fs = require('fs');
const Excel = require('exceljs');

let outStream = fs.createWriteStream('/tmp/aaa', {flags: 'w'})

let options = {
    stream: outStream,
    useStyles: true,
    useSharedStrings: true
};

let workbook = new Excel.stream.xlsx.WorkbookWriter(options);
let worksheet = workbook.addWorksheet('test');
let newrow = worksheet.addRow(['hello']);
newrow.commit();
worksheet.commit();
workbook.commit();

If you do not add any row, it works fine. Also, worked fine on 0.2.9 and previous versions.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
danieledscommented, Sep 1, 2016

Thank you for the wonderful project!

1reaction
guyonrochecommented, Sep 1, 2016

Merged the PR. I also added an integration-test that used your example @danieleds so this regression should not happen again. Thanks everyone!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Regression] Stream API fails to write XLSX files #150 - GitHub
Since version 0.2.10, exceljs fails to write xlsx files using the stream API with the following error: Unhandled rejection Error: append: ...
Read more >
EPPlus Error When Outputting .XLSX to Response
If you read my original post, the problem is that when I output the file to the STREAM ONLY, it gives me this...
Read more >
Excel Writer (v9.2) parameter Stream XLSX doesn't work ...
I read Excel files all the time, but not with the "Streaming" option. I use Spread Sheet Type "Excel 2007 XLSX (Apache POI)",...
Read more >
exceljs - npm
Merged Fix regression #150: Stream API fails to write XLSX files. Apologies for the regression! Thanks to danieleds for the fix.
Read more >
Data Driven Framework in Selenium WebDriver Using Apache ...
Selenium Webdriver is a great tool to automate web-based applications. But it does not support read and write operations on excel files.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found