These are chat archives for PHPOffice/PHPExcel

Jan 2017
James McFadden
Jan 19 2017 10:56

Hi all,

I'm downloading a customer's XLSX file from a remote server and trying to parse it using PHPExcel. The file opens fine in Numbers, but when I try and do the following:

$reader = PHPExcel_IOFactory::load($xlsxFilepath);
$sheets = $reader->getSheetNames();
$sheet = $reader->getSheet(0);
$maxCol = $sheet->getHighestDataColumn();
$maxRow = $sheet->getHighestDataRow();


I get the following:

array(1) {
  [0] =>
  string(9) "Worksheet"

which is not the correct name of the sheet. Additionally, $maxCol is A and $maxRow is 0, but I'm expecting around 400 rows across ~26 columns.

If I open the file in Numbers and re-export it to XLSX, the code above works. I understand this is likely not an issue with PHPExcel, but has anyone encounted an issue like this before? Could it be to do with how the remote file was saved?