I'm doing a data pull from excel to display the output in HTML via PHP dependent on the day of the week. My code is as follows:
$dw = date('N');
if($dw==1) {$objWorksheet = $objPHPExcel->getActiveSheet(10);}
elseif($dw ==2) {$objWorksheet = $objPHPExcel->getActiveSheet(11);}
elseif($dw==3) {$objWorksheet = $objPHPExcel->getActiveSheet(12);}
elseif($dw==4) {$objWorksheet = $objPHPExcel->getActiveSheet(13);}
elseif ($dw == 5) {$objWorksheet = $objPHPExcel->getActiveSheet(14);}
$A = $objWorksheet->getCellByColumnAndRow(0, $row)->getValue();
$B = $objWorksheet->getCellByColumnAndRow(1, $row)->getValue();
$C = $objWorksheet->getCellByColumnAndRow(2, $row)->getValue();
$D = $objWorksheet->getCellByColumnAndRow(5, $row)->getValue();
$E = substr(($objWorksheet->getCellByColumnAndRow(6, $row)->getValue()), 0, 1);
$F = $objWorksheet->getCellByColumnAndRow(7, $row)->getValue();
The problem I'm having is that instead of getting the data from sheet 10
, I'm getting the data from sheet 1
. In fairness even if I change the active sheet number to correspond to a different sheet I still get the same output yet further down the sheet I use a piece of code to pull the date and time from sheet 0
and this works fine.
I'd appreciate any suggestions on how to fix this