aVadim483 / fast-excel-reader

Lightwight and very fast XLSX Excel Spreadsheet Reader in PHP
MIT License
63 stars 16 forks source link

Doesn't work with a lot of xlsx files #8

Closed fabiochelly closed 1 year ago

fabiochelly commented 1 year ago

I tried to replace phpspreadsheet with fast-excel-reader to convert some files to CSV. But a lot of files sent by my clients can't be read with this lib. This one for instance (see attached file).

No exception, readRows return an empty array and $sheet->nextRow() doesn't work either.

Feuille de calcul sans titre (40).xlsx

aVadim483 commented 1 year ago

It seems that this file was not created using Microsoft Excel, but I will see how I can solve this problem

aVadim483 commented 1 year ago

Well, I've resolved this problem in v.2.1.1 and the test passed successfully with you file

fabiochelly commented 1 year ago

OK, it works fine now for these kind of file.

By the way I noticed something: when the xlsx file path supplied is wrong (file is missing for instance), it provokes a fatal error. In your Reader.php, it seems that you test if ($zip->open()) { } But you're supposed to check: $zip->open(...) === true (with a strict comparison). Because $zip->open() can return an error code (int) that can be interpreted as true

It's not a big problem but when the path is wrong, we get a Fatal error instead of an exception.

aVadim483 commented 1 year ago

yep, you're right, I'll add error handling here

aVadim483 commented 1 year ago

done