Search code examples
javascriptnode.jsxlsx

Error: Corrupted zip : can't find end of central directory - XLSX


I'm trying to read my excel file by using XLSX npm. While read its throwing error as 'Corrupted zip : can't find end of central directory'

This is error I'm getting,

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)

Solution

  • Why its throwing error is, we are trying to read the file its completely downloaded from any cloud or somewhere else. So before read your excel file ensure that file is not in write mode. Once file completely downloaded try to populate the Excel data.

    Hope it will solve your issue.