Comments (38)
@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.
- I suspect this has something to do with .DS_Store files on my mac so I have tried to delete them but this is still happening.
- I have tried to remove all node modules and re-install few times.
- ... do you have any other ideas?
from sheetjs.
i too have the same issue
from sheetjs.
@nox0311 I understand :) If you open the file in notepad, what are the first five characters?
- If you see PK followed by some junk, then it's a zip file
- If you see binary, it's likely to be an XLS file
- If you see <? or <W then it's most likely a xml workbook
- If you just see your data in plaintext, then it's most likely a CSV or TSV file. See if there are commas.
from sheetjs.
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
Error: Corrupted zip : can't find end of central directory",
" at ZipEntries.readEndOfCentral (/Users/pedromarandi/projects/replenishment/node_modules/xlsx/jszip.js:2281:19)",
" at ZipEntries.load (/Users/pedromarandi/projects/replenishment/node_modules/xlsx/jszip.js:2343:14)",
" at new ZipEntries (/Users/pedromarandi/projects/replenishment/node_modules/xlsx/jszip.js:2167:14)",
" at JSZipSync.module.exports [as load] (/Users/pedromarandi/projects/replenishment/node_modules/xlsx/jszip.js:580:18)",
" at new JSZipSync (/Users/pedromarandi/projects/replenishment/node_modules/xlsx/jszip.js:527:14)",
" at read_zip (/Users/pedromarandi/projects/replenishment/node_modules/xlsx/xlsx.js:20267:24)",
" at Object.readSync [as read] (/Users/pedromarandi/projects/replenishment/node_modules/xlsx/xlsx.js:20335:69)",
" at read (/Users/pedromarandi/projects/replenishment/src/lib/sheetUtils.js:23:15)",
" at _callee$ (/Users/pedromarandi/projects/replenishment/src/lib/validations/validatePurchaseOrderFile.js:28:21)",
" at tryCatch (/Users/pedromarandi/projects/replenishment/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:45:40)",
" at Generator.invoke [as _invoke] (/Users/pedromarandi/projects/replenishment/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:271:22)",
" at Generator.prototype.(anonymous function) [as next] (/Users/pedromarandi/projects/replenishment/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:97:21)",
" at asyncGeneratorStep (/Users/pedromarandi/projects/replenishment/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)",
" at _next (/Users/pedromarandi/projects/replenishment/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)",
" at process._tickCallback (internal/process/next_tick.js:68:7)"```
from sheetjs.
i am also facing the same issue
from sheetjs.
@PedramMarandi @hlynurl at this point it's most likely a corruption issue somewhere else. To check:
- Write the buffer to file and see if you can open it in Excel
- actually log Buffer.isBuffer(data) and confirm you are dealing with a buffer
from sheetjs.
@remotevision any updates?
from sheetjs.
@remotevision I'm going to close this for now. If you can reproduce this problem, please comment and reopen the issue.
from sheetjs.
@nox0311 can you share a file that triggers the error?
from sheetjs.
hey i got a solution to this issue.....
we get this error if app uses excel file which are created by any other application other than Microsoft Excel...
for eg: if we create an excel file using .net applications the we encounter such erros since the header is different as to which is Set by MicrosoftExcel...
We wont get this error if excel files used are created by MS excel
from sheetjs.
@nox0311 Excel really doesn't care about the file extension. It looks at the content to determine how to parse. To see this, you can take a CSV file, rename as XLSX, and try to open in excel.
Two things:
-
Can you try with js-xls ( https://github.com/SheetJS/js-xls ) and see if it parses there?
-
Can you open the file with wordpad or notepad and see if the file is actually a CSV?
from sheetjs.
i tried parsing that file using the js-xls module mentioned above and it gives an error as:
"unsupported file";
and that file can be opened with notepad and i can see the data clearly there
from sheetjs.
@nox0311 Is it a CSV or TSV or HTML file? (also can you send me a copy?)
from sheetjs.
i tried another file which was created by c#.net application and still it was parsed properly. but when opened with notepad it gave random symbols.
from sheetjs.
@SheetJSDev the file i m using has some sensitive info of organisation i m working in so wont be able to send u a copy....
i m trying to figure out a way to parse these files and will let u know if i arrive at some solution
from sheetjs.
the file which i m using shows data as plaintext in notepad but gives error "Unsupported File" when used with xls module.
it has extension .xls and this file is created by an application other than MS Excel.
i created another file "demo.xls" in MS Excel and copied all the data from above file in demo.xls .
this file parses easily.
so the conclusion I come to is that Files which are created by MSExcel are parsed easily.
from sheetjs.
@nox0311 re-read #35 (comment)
Excel really doesn't care about the file extension. It looks at the content to determine how to parse. To see this, you can take a CSV file, rename as XLSX, and try to open in excel.
You should use a CSV or TSV parser for the file.
There is an attempt at a unified parser https://github.com/SheetJS/j for all formats, but right now it only supports 5: http://sheetjs.com/status/
Since this doesn't directly relate to the XLSX or related formats, I'm going to close the issue here but open a related issue in the relevant project
from sheetjs.
Im having the same issue trying to parse a .xls file. It Promt
Error: Corrupted zip : can't find end of central directory
I download the file from a website made on .net (aspx)
from sheetjs.
I'm getting this with [email protected] in node versions 0.12.4 and 4.2.1: Error: Corrupted zip : can't find end of central directory
The file I'm getting the error with is here: http://www1.nyc.gov/assets/finance/downloads/pdf/rolling_sales/neighborhood_sales/staten_island_sales_prices.xls
The file is binary, and works fine in Excel.
from sheetjs.
I'm getting this with xlsx with dates
from sheetjs.
Hi I was also facing similar issue, while importing .xlsx file "Error: Corrupted zip : can't find end of central directory" .. I tried following which solved the issue. ''result'' is the file input and truncate the format.
var data = result.toString().replace("data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,", "");
data = data.toString().replace("data:text/xlsx;base64,", "");
$window.xlsx(data); // call the library now..
Since I used excel-builder.js to generate the file. I modified some part xlsx.js library to element styling.
Its working for me well .
Thank You
from sheetjs.
anybody has a proper fix for this ? Any chance we could reopen this ticket ?
from sheetjs.
@shankararul I'm having the same problem: Corrupted zip : can't find end of central directory
from sheetjs.
Hey @cicerohen, i kind of figured out a workaround in this error - http://stackoverflow.com/a/36261090/786326 (Hope it helps)
from sheetjs.
@shankarul this error occurred for me why in my function I tried execute readFile(filePath) before the readStream(filePath) end.
from sheetjs.
I have a similar issue but with parsing docx... Passing the same path by one method ie a string creates the error whilst using another drag drop API works weird
from sheetjs.
The input type has to match the specified type, as explained in the input type table.
from sheetjs.
i have got the same issue ,Corrupted zip : can't find end of central directory
im sure this file can open with ms excel
from sheetjs.
@FlyerJay if you can reproduce the issue in the live demo then it's a bug in the parsing logic and we would love to see an offending file. You can email it to us or attach to a reply here.
If you cannot reproduce the issue in the demo, then there's an issue in your integration code and we would need to see a code snippet to advise further.
from sheetjs.
from sheetjs.
@FlyerJay http://oss.sheetjs.com/js-xlsx/ reads the file:
This is the full output: https://hastebin.com/zopiresadu.http
My guess is that you are either using an older version or your integration code is not correct. Can you check if the version is 0.9.11? console.log(XLSX.version)
somewhere in your code
from sheetjs.
thank you!!i know where the problem is
from sheetjs.
@SheetJSDev Hey, I still have the same issue while reading extremely large excel (over than 20Mb, xlsx), I tried to use node stream to handle each chunk because it cannot figure out the sheet results by using XLSX.readFile directly, but it doens't work for that. Could you give me some advices?
from sheetjs.
I am having this problem. I cannot read any excel files from buffers anymore.
from sheetjs.
i solved mine by changing the editor
from sheetjs.
For me I had the same error when the input file was protected by a password
from sheetjs.
can not work with xlsx, just xls can be use
Error: Corrupted zip : can't find end of central directory
at u.readEndOfCentral (xlsx.core.min.js:2)
at u.load (xlsx.core.min.js:2)
at new u (xlsx.core.min.js:2)
at n.r.exports [as load] (xlsx.core.min.js:2)
at new n (xlsx.core.min.js:2)
from sheetjs.
@hutao96 please raise a new issue and include some details like the actual read call and how the data is obtained
from sheetjs.
Related Issues (20)
- Gettting an Array, but of scrambled data 😰 HOT 2
- sheet_to_json from remote file not working HOT 2
- Unable to set name for worksheet separately from workbook HOT 3
- xlsx CP932 Incorrect output HOT 3
- Error appears in bower js-xlsx#~0.11.5 HOT 4
- sheet_to_json: inconsistent blank cell parsing HOT 2
- format entire column HOT 2
- reading text in shapes HOT 1
- Rearranging the XLSX.write order HOT 1
- Add VBA script to file I am creating from scratch HOT 2
- Wrong filename when download file HOT 1
- How to Define name for a range ? HOT 1
- Need to Prevent formatting of dates while reading a csv
- No option to change delimiter when writing CSV HOT 1
- Export to excel- Hyperlink doesn't work on documentation page HOT 1
- reading and writing the excel with Symbols,photos, in different tabs.
- QUOTE not defined HOT 9
- [Security] Prototype Pollution in sheetJS HOT 27
- Archive this GitHub Project HOT 3
- Thanks!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sheetjs.