I'm trying to upload a spreadsheet using phpspreadsheet.
I simply want to copy the values of each cell I see when I open the spreadsheet in open office, into the database
The problem is in one of the columns, the value is calculated and despite reading the phpspreadsheet documentation, I can't find out how to do this.
The value I can see if I open the spreadsheet with Open Office would be just a float like 9.12, but in the input bar where you'd type a formula, the value is:
=VLOOKUP(A2,'file:///Folder for Tenders & Information required/October19/All Group Pricing Oct 2019 working.xlsx'#$'PI''s'.$A$1:$Y$1048576,25,0)
If I run this code:
$reader = IOFactory::createReader('Xlsx');
$spreadsheet = $reader->load($inputFileName2);
$worksheet = $spreadsheet->getActiveSheet();
$value = $spreadsheet->getActiveSheet()->getCell('F2')->getCalculatedValue();
echo $value;
That produces the error:
Fatal error: Uncaught PhpOffice\PhpSpreadsheet\Calculation\Exception: PI!F2 -> Formula Error:
If I change getCalculatedValue() to getValue()
I get:
=VLOOKUP(A2,'[1]PI''s'!$A:$Y,25,FALSE)
How on earth do I just get the value that I can see when I open the spreadsheet in Open Office?
Thanks :-)