Here is a code to extract sheet data:
private function extractData($fileName)
{
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$reader->setReadDataOnly(true);
$objPHPExcel = $reader->load($fileName);
$sheets = $objPHPExcel->getSheetNames();
$sheetName = 'Sheet 1';
$objPHPExcel->setActiveSheetIndexByName($sheetName);
$objWorksheet = $objPHPExcel->getActiveSheet();
// Slice away title, subtitle
$rows = $objWorksheet->toArray();
$headers = array_shift($rows);
return [$rows, $headers];
}
which gives error:
BSC Dataset!F2 -> Formula Error: An unexpected error occured
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php(2563): PhpOffice\PhpSpreadsheet\Cell\Cell->getCalculatedValue()
#1 vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php(2639): PhpOffice\PhpSpreadsheet\Worksheet\Worksheet->rangeToArray('A1:F4177', NULL, true, true, false)
The file in question has a vookup referencing another sheet on column F.
=IF($E2="Customer Pay Bonus Achievement",VLOOKUP($A2&$B2,$'Customer Pay Tracking'.$C:$V,5+$D2,0),VLOOKUP($A2&$B2,$'Wholesale+Counter'.$C:$X,5+$D2,0))