Maatwebsite Excel formula is showing instead of values

51 views Asked by At

I'm using laravel 10 with PHP version 8.1 and also using package called Laravel Excel. Now I'm facing the problem I've file in xlsx format and have only 5 records for testing purpose in file I've column called first_name, last_name, email, company, address, street, suite, city, state, zipcode, country & phone. Now in address field I add formula =H2 & ", " & I2 & " " & J2 and getting values city, state & zipcode like this New york city, NY & 10005, this is what showing in xlsx file in address column now when I import that file and add these records into database instead of values the formula is storing into database like this =H2 & ", " & I2 & " " & J2 I've searched on different platforms and found this WithCalculatedFormulas about Maatwebsite Excel and added it like this

use Maatwebsite\Excel\Concerns\WithCalculatedFormulas;

class AddressImport implements ToModel, WithCalculatedFormulas, WithHeadingRow, WithChunkReading, SkipsOnError 
{ 
   my code here for inserting data into database 
}

but it didn't work as expected and formula is storing in database instead of its values

So what is the problem can someone tell me.

Thanks in advance.

I've tried

trait called

use Maatwebsite\Excel\Concerns\WithCalculatedFormulas;

but nothing works.

0

There are 0 answers