PHPOffice / PhpSpreadsheet

A pure PHP library for reading and writing spreadsheet files
https://phpspreadsheet.readthedocs.io
MIT License
13.26k stars 3.42k forks source link

Microsoft excel files of different version do not read files #3979

Open rupaliipte opened 5 months ago

rupaliipte commented 5 months ago

Discussed in https://github.com/PHPOffice/PhpSpreadsheet/discussions/3978

Originally posted by **rupaliipte** April 10, 2024 Hello, We are reading excel files created Excel 2016 version and it is working perfectly. But now we are using Excel 2019 version and file stop reading. It shows error like PHP Warning: Trying to access array offset on the value of type null in D:\laravel\xxxxx\xxxxx\xxxxxx.php on line 691. Reading file and passing array Null. Does the library support Excel 2019? Sample code of reading excel - Working fine for excel 2016 but not excel 2019 files $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); //Get Mapping table columns and row index of scheme code $mappingSpreadsheet = $reader->load("$INPUT_DIRECTORY/$mappingFileName"); $mappingSpreadsheetData=$mappingSpreadsheet->getActiveSheet()->toArray(); Thank You
MarkBaker commented 5 months ago

PhpSpreadsheet is tested with files generated using a variety of Excel versions, including 2016, 2019, 2021 and 365, but not tested against every conceivable feature of Excel in every version. If it is failing to read a valid Excel file, it's because that file contains something that it doesn't understand, but without seeing an example file to demonstrate and debug a problem, we can't identify exactly what that might be.

Note that I can't guess what file D:\laravel\xxxxx\xxxxx\xxxxxx.php might be, nor what is at line 691 of that file.