Coder Social home page Coder Social logo

Comments (38)

hlynurl avatar hlynurl commented on May 5, 2024 4

@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.

nox0311 avatar nox0311 commented on May 5, 2024 3

i too have the same issue

from sheetjs.

SheetJSDev avatar SheetJSDev commented on May 5, 2024 3

@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.

PedramMarandi avatar PedramMarandi commented on May 5, 2024 3

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.

jeevanhr7 avatar jeevanhr7 commented on May 5, 2024 1

i am also facing the same issue

from sheetjs.

SheetJSDev avatar SheetJSDev commented on May 5, 2024 1

@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.

SheetJSDev avatar SheetJSDev commented on May 5, 2024

@remotevision any updates?

from sheetjs.

SheetJSDev avatar SheetJSDev commented on May 5, 2024

@remotevision I'm going to close this for now. If you can reproduce this problem, please comment and reopen the issue.

from sheetjs.

SheetJSDev avatar SheetJSDev commented on May 5, 2024

@nox0311 can you share a file that triggers the error?

from sheetjs.

nox0311 avatar nox0311 commented on May 5, 2024

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.

SheetJSDev avatar SheetJSDev commented on May 5, 2024

@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:

  1. Can you try with js-xls ( https://github.com/SheetJS/js-xls ) and see if it parses there?

  2. Can you open the file with wordpad or notepad and see if the file is actually a CSV?

from sheetjs.

nox0311 avatar nox0311 commented on May 5, 2024

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.

SheetJSDev avatar SheetJSDev commented on May 5, 2024

@nox0311 Is it a CSV or TSV or HTML file? (also can you send me a copy?)

from sheetjs.

nox0311 avatar nox0311 commented on May 5, 2024

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.

nox0311 avatar nox0311 commented on May 5, 2024

@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.

nox0311 avatar nox0311 commented on May 5, 2024

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.

SheetJSDev avatar SheetJSDev commented on May 5, 2024

@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.

cristiandley avatar cristiandley commented on May 5, 2024

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.

fitnr avatar fitnr commented on May 5, 2024

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.

stasyaner avatar stasyaner commented on May 5, 2024

I'm getting this with xlsx with dates

from sheetjs.

Raghavendra22g avatar Raghavendra22g commented on May 5, 2024

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.

 avatar commented on May 5, 2024

anybody has a proper fix for this ? Any chance we could reopen this ticket ?

from sheetjs.

cicerohen avatar cicerohen commented on May 5, 2024

@shankararul I'm having the same problem: Corrupted zip : can't find end of central directory

from sheetjs.

 avatar commented on May 5, 2024

Hey @cicerohen, i kind of figured out a workaround in this error - http://stackoverflow.com/a/36261090/786326 (Hope it helps)

from sheetjs.

cicerohen avatar cicerohen commented on May 5, 2024

@shankarul this error occurred for me why in my function I tried execute readFile(filePath) before the readStream(filePath) end.

from sheetjs.

Mwaiwathu avatar Mwaiwathu commented on May 5, 2024

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.

SheetJSDev avatar SheetJSDev commented on May 5, 2024

The input type has to match the specified type, as explained in the input type table.

from sheetjs.

FlyerJay avatar FlyerJay commented on May 5, 2024

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.

SheetJSDev avatar SheetJSDev commented on May 5, 2024

@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.

FlyerJay avatar FlyerJay commented on May 5, 2024

error.xlsx

from sheetjs.

SheetJSDev avatar SheetJSDev commented on May 5, 2024

@FlyerJay http://oss.sheetjs.com/js-xlsx/ reads the file:

screen shot 2017-04-20 at 00 01 02

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.

FlyerJay avatar FlyerJay commented on May 5, 2024

thank you!!i know where the problem is

from sheetjs.

bennettluo avatar bennettluo commented on May 5, 2024

@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.

hlynurl avatar hlynurl commented on May 5, 2024

I am having this problem. I cannot read any excel files from buffers anymore.

from sheetjs.

mwangiKibui avatar mwangiKibui commented on May 5, 2024

i solved mine by changing the editor

from sheetjs.

bertrandmartel avatar bertrandmartel commented on May 5, 2024

For me I had the same error when the input file was protected by a password

from sheetjs.

hutao96 avatar hutao96 commented on May 5, 2024

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.

SheetJSDev avatar SheetJSDev commented on May 5, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.