Error: Corrupted zip : can't find end of central directory
See original GitHub issueEDIT: if you encounter this issue, confirm you are using the latest version and that you are using the correct input type! See https://github.com/sheetjs/sheetjs#input-type
For example, using a FileReader with readAsArrayBuffer will call the load event where the result is an ArrayBuffer, so type should be "array"
If data is received through an XHR or fetch, verify that the source data is not UTF8-encoded. Some platforms like AWS Gateway API do this automatically and require an override as explained in the function demo
–
I am trying to use this library to parse a base64 encoded .xslx file on the server using node.js. I have also removing the base64 header info and loading the data into a binary buffer, but I get the same error.
Here is my function to parse the file:
var parseFile = function(data){
var xlsx = XLSX.read(data, {type: 'base64'});
var sheet_name_list = xlsx.SheetNames;
xlsx.SheetNames.forEach(function(y) {
for (z in xlsx.Sheets[y]) {
if(z[0] === '!') continue;
console.log(y + "!" + z + "=" + JSON.stringify(xlsx.Sheets[y][z].v));
}
});
};
However, when I try to parse the data, I get the following error.
Error: Corrupted zip : can't find end of central directory
at Object.ZipEntries.readEndOfCentral (/Users/.../node_modules/xlsx/jszip.js:2087:27)
at Object.ZipEntries.load (/Users/.../node_modules/xlsx/jszip.js:2104:18)
at Object.ZipEntries (/Users/.../node_modules/xlsx/jszip.js:2010:18)
at Object.JSZip.load (/Users/.../node_modules/xlsx/jszip.js:2115:22)
at Object.JSZip (/Users/.../node_modules/xlsx/jszip.js:5:14)
at Object.readSync [as read] (/Users/.../node_modules/xlsx/xlsx.js:940:24)
at parseFile (/Users/.../routes/tickets.js:35:19)
any thoughts as to why this might be happening? When I load my file into your demo site, it parses it to json just fine.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:3
- Comments:38 (12 by maintainers)

Top Related StackOverflow Question
@SheetJSDev thank you for your advice.
I have confirmed I am dealing with a buffer. This is not something that happened while writing new code. This is all of a sudden happening in my codebase which worked fine before on the exact same files. I even have an app in production working fine which was deployed from my last commit but if I clear all changes and revert back to that commit this still happens.
After 6 years there is no solution to this problem 👯 I’m facing with the same issue, I’m trying to read Buffer but I get the below exception