Exceljs: Error in jszip

Created on 19 Jan 2018  路  3Comments  路  Source: exceljs/exceljs

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"
  }

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.

All 3 comments

I have noticed this for xls file. I .xlsx doesn't have any similar issue.

https://github.com/sheetjs/js-xlsx

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MR4online picture MR4online  路  3Comments

dm-ibtissam picture dm-ibtissam  路  4Comments

kurt343 picture kurt343  路  3Comments

jtraband picture jtraband  路  3Comments

faradaytrs picture faradaytrs  路  3Comments