I have a problem in which one of the read numbers is correct because in excel worksheet it's just a number, but the second one returns a formula. I have tried several methods suggested on other topics of forums but neither of them worked correctly. What else can I do to solve this problem? I just need to read couple of cells from my .xlsx excel file.
Code:
include "PHPExcel-1.8\Classes\PHPExcel\IOFactory.php";
$inputFileName = 'C:\Users\tfd054it0154\Desktop\dane na spotkanie.xlsx';
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
// Read Excel workbook
try {
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
} catch(Exception $e) {
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}
$value1 = $objPHPExcel->getActiveSheet()->getCell('B8')->getValue();
echo $value1;
$value2 = $objPHPExcel->getActiveSheet()->getCell('C8')->getValue();
echo $value2;