Cannot open xlsx files created by XLSL.writeFile
See original GitHub issueI’m trying to use js-xlsx to generate xlsl files for my Electron app. I followed the demo and can also create a xlsl file, here is the code:
const data = [
["Name", "Age", "Location"],
["Bob", 24, "NYC"],
["Jason", 30, "LA"]
];
const ws: XLSX.WorkSheet = XLSX.utils.aoa_to_sheet(data);
const wb: XLSX.WorkBook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
XLSX.writeFile(wb, "SheetJS.xlsx");
Everything works fine before opening the generated file with Excel, when Excel warned me that the file cannot be opened, because of invalid file format or extesion. I’m not sure what’s wrong about my code, did I miss something?
Here’s how my development env goes:
- OS: Window 10
- Electron: 5.0.1
- Angular: 7.2.15
- xlsx: 0.15.0
- Excel: Microsoft Office Professional Plus 2013
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Excel cannot be open the file 'filename.xlsx' because the file ...
1) The file is not compatible with the MS Excel version. ... In Excel 2007, click the 'Microsoft Office' button and then 'Excel...
Read more >Problematic corruption of .xlsx files with NPOI - Excel cannot ...
Problematic corruption of .xlsx files with NPOI - Excel cannot open the file 'file.xlsx" because the file format or file extension is not...
Read more >Data Export | SheetJS Community Edition
The writeFile method packages the data and attempts to save the new file. The export file format is determined by the extension of...
Read more >Why is there a permission error when repeat writing to excel file?
Unable to write to file 'RegressionResults.xlsx'. You may not have write permissions or the file may be open by another application.
Read more >Python | Create and write on excel file using xlsxwriter module
Let's see how to create and write to an excel-sheet using Python. ... It cannot read or modify existing Excel XLSX files.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is not useful. Why use old format xls?
I solved the problem with this
XLSX.writeFile (wb," SheetJS.xls ");
When you write the file, the last line of your code, you must change
XLSX.writeFile (wb," SheetJS.xlsx ");
ToXLSX.writeFile (wb, 'book.xls')
In other words, change the format of the xlsx file to xls