I am using phpoffice\Phpspreadsheet and when I upload Excel it shows me error Top Sheet!E102 -> Top Sheet!E15 -> Table Table7 for Structured Reference cannot be located

My code is:

$file = $request->file;

$readerExtension = ucfirst($file->getClientOriginalExtension());
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($readerExtension);
$reader->setReadDataOnly(true);
$spreadsheet = $reader->load($request->file('file'));
$allSheetsArray = $spreadsheet->getSheetNames();

$import = $spreadsheet->getSheetByName('Top Sheet');
$cell = $import->getCell('E102');
$cellDataType = $cell->getDataType();
//$colValue = $import->getCell('E102')->getCalculatedValue();
dd($cell);

But when we dump data it shows the result in calculated value. Can anyone please help me with this issue? I have tried many methods to solve this problem but no luck.

enter image description here

Excel file

enter image description here

1

There are 1 best solutions below

0
Ashok On

when we use

$colValue = $import->getCell('E102')->getOldCalculatedValue();

its working fine.