mardi 26 novembre 2019

PhpSpreadsheet: How to get result of a named column in a formula?

Formula

I'm using PhpSpreadsheet to read .xlsx files, and one of the files I'm trying to import has this formula(image above).

I would get the error "Formula Error: An unexpected error occurred".

This is my code:

$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$spreadsheet = $reader->load($inputFileName);
$data= $spreadsheet->getActiveSheet()->toArray(null, true, true, true);

If I try to set the 2nd argument to false:

$data= $spreadsheet->getActiveSheet()->toArray(null, false, true, true);

I won't get any errors but would return just the formula.

"=Table1[[#This Row],[Amount  With Tax ]]-Table1[[#This Row],[Tax]]"

How can I get the actual result base on the formula?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire