I've been debugging for hours, and cannot seem to figure out the problem.
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcelReader = $objReader->load($inputFileName);
$objPHPExcelReader->setActiveSheetIndex(1);
$sheetName = $objPHPExcelReader->getActiveSheet()->getTitle();
echo "<strong>UPLOAD SUCCESSFUL!</strong><br /><br />";
echo "Excel Path: $target_path<br /><br />";
echo "$sheetName <br /><br />";
$ytd_actual = $objPHPExcelReader->getSheet(1)->getCell('Z11')->getValue();
$ytd_budget = $objPHPExcelReader->getActiveSheet()->getCell('AX11')->getValue();
Both values come back empty, notice I tried both methods
getSheet(1) -> to set a specific sheet
getActiveSheet() -> to use the active sheet (which I set in the beginning)
The sheetname outputs correctly, so I know the right sheet is selected.
Here is the funny part! If I use just the activesheet, without specifying setActiveSheet it works no problem to pull the data from the 1st sheet. Moment I set it to the 2nd sheet, it gives me issues.
If I even try and change
$ytd_actual = $objPHPExcelReader->getSheet(1)->getCell('Z11')->getValue();
to...
$ytd_actual = $objPHPExcelReader->getSheet(0)->getCell('Z11')->getValue();
It'll give me the value from the 1st sheet without issue. 2nd sheet, nothing...
What am I doing wrong? (rest assured the cell mapping is correct, there is values)