I get this error trying to read file
Error: Can't find end of central directory : is this a zip file ? If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html
at Object.readEndOfCentral (C:\Users\yakovlev\Desktop\TypescriptAPIServer\node_modules\exceljs\node_modules\jszip\lib\zipEntries.js:168:23)
at Object.load (C:\Users\yakovlev\Desktop\TypescriptAPIServer\node_modules\exceljs\node_modules\jszip\lib\zipEntries.js:256:14)
at C:\Users\yakovlev\Desktop\TypescriptAPIServer\node_modules\exceljs\node_modules\jszip\lib\load.js:49:20
at process._tickCallback (internal/process/next_tick.js:103:7)
My code
import * as Excel from 'exceljs';
Excel.config.setValue('promise', global.Promise);
const wb = new Excel.Workbook();
const filename = path.join(__dirname, '../../test/test.xls');
wb.xlsx.readFile(filename)
.then(
() => console.log('test'),
(err) => console.log(err));
code in typescript file with following compiler params
"compilerOptions": {
"target": "es2015",
"module": "CommonJS",
"moduleResolution": "node"
}
I have noticed this for xls file. I .xlsx doesn't have any similar issue.
This project supports .xlsx only - there is no support for .xls at all as that's a completely different format (despite the similar name).
It would be great if this returned a more user-friendly error ("XLS files are not supported!") since it's quite hard to expose this stream directly without hacking that in yourself. Will send a PR if the maintainers are interested.
Most helpful comment
It would be great if this returned a more user-friendly error ("XLS files are not supported!") since it's quite hard to expose this stream directly without hacking that in yourself. Will send a PR if the maintainers are interested.