I'm using the library phpspreadsheet, and I have a problem on one of my cell.
In my excel I got:
C | D | |
---|---|---|
8 | 12% (calculated by excel with complicated formula) | 12% (formula: =C8) |
The cell D8 value is "=C8" but when I read it with getCalculatedValue I don't get the value of C8 (12%) but literally "=C8".
<?php
$my_spreadsheet->getSheetByName('first sheet')->getCell("D8")->isFormula(); #true
$my_spreadsheet->getSheetByName('first sheet')->getCell("D8")->getCalculatedValue(); #=C8
$my_spreadsheet->getSheetByName('first sheet')->getCell("D8")->getFormattedValue(); #=C8
$my_spreadsheet->getSheetByName('first sheet')->getCell("D8")->getValue(); #=C8
The formula are mostly well calculated, but I have some cell that are not calculated like the one above, they are all formatted as percent.
Did I have a corrupted cell or did I miss a parameter?
PS Sorry for the english
Could it be that you use
$Reader->setReadDataOnly( true );
this says read only the data and that you can't use the calculation more information see here.
Remove above line or set it to false.
A other possibility is that you not configuration the calculation engine right. Please check link above.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.