Exceljs: Saving XLS to Linux

Created on 1 Jun 2016  路  3Comments  路  Source: exceljs/exceljs

I am using exceljs on a node.js server to create and save an excel file for emailing to users. It works well on a local mac machine in development, but on the AWS hosted linux server we're using it produces a problem. The file appears to be written ok, but on trying to open it we receive a warning that the file is corrupt.

The relevant code is:

workbook.xlsx.writeFile(excelFile)
                .then(function () {
                   console.log("Done OK.");
code continues here

Notice that Done OK is never console.logged

My first question is whether the .then(function call takes an error argument which might provide further information on what is happening?

If not any ideas what is going wrong?

If there is a problem with saving to linux filesystem (although it does write fine to our Mac) is there a way to save the file to Amazon S3 storage or even stream it straight to nodemailer for emailing?

Most helpful comment

Is there a way to create an excel file and save it to Amazon S3 storage?

All 3 comments

When working with promises, you should always have a catch block at the end of the promise chain. Something is likely breaking in when trying to write. There are no problems saving to linux.

Example

workbook.xlsx.writeFile(excelFile)
.then(function () {
  console.log("Done OK.");
})
.catch(function (err) {
  console.error(err.stack);
});

Is there a way to create an excel file and save it to Amazon S3 storage?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dcrystalj picture dcrystalj  路  3Comments

grbspltt picture grbspltt  路  4Comments

dm-ibtissam picture dm-ibtissam  路  4Comments

CountryGuide picture CountryGuide  路  3Comments

nandakumardtc picture nandakumardtc  路  3Comments