I'm using Laravel excel to import headers & some records.
With this approach, I should able to get headers:
$headings = (new HeadingRowImport)->toArray($myFile);
If $myFile is a CSV, it's OK; but if I tried with XLS or XLSX (with valid Mimetypes: application/vnd.ms-excel and application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, I'm getting such issue:
ZipArchive::getFromName():
Invalid or uninitialized Zip object {"exception":"[object] (ErrorException(code: 0):
ZipArchive::getFromName(): Invalid or uninitialized Zip object at
/var/www/app/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php:308)
I have tried to find related bugs but I only found PhpExcel, or PhpSpreadsheet, eg:
- Read Xlsx file in PhpSpreadsheet
- Why am I getting an "invalid or unitialized Zip object" error when trying to read excel file via PHP?
- PHPExcel Warning: ZipArchive::getFromName(): Invalid or unitialized Zip object in
And I cannot find useful fix from them. Did anyone faced this issue, and how did you fix it ?
My package versions:
- "php": "^7.1.3",
- "laravel/framework": "5.8.*",
- "maatwebsite/excel": "^3.1",
Note that my file has read permission as it is 644, and I can open the file with fopen($myFile, 'r')
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire