I'm trying to read the cells in my xlsx file with PHPExcel but I can not get it.
require_once('Classes/PHPExcel.php');
require_once('Classes/PHPExcel/Reader/Excel2007.php');
$objReader = new PHPExcel_Reader_Excel2007();
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load('C:\xampp\htdocs\hotelplayagolfsitges\wp-content\tesipro.xlsx');
echo 'La celda A2 es: ' . $objPHPExcel->getActiveSheet()->getCell('A2')->getFormattedValue();
echo '<br/>La celda B1 es: ' . $objPHPExcel->getActiveSheet()->getCell('B2')->getCalculatedValue();
echo '<br/>La celda B1 es: ' . $objPHPExcel->getActiveSheet()->getCell('C2')->getCalculatedValue();
I have this code, the problem is that I do not know whether to use getCalculatedValue()
, getValue()
, getFormattedValue()
or what method to use since I have used them all, but Calculated
or Value
returns me all the formula, and I do not want the formula, I just want to get the result that is in each cell as seen in Excel.