Named formula issue when uploading Excel in Laravel

Viewed 254

I'm using "maatwebsite/excel": "^3.1" library and importing file WithCalculatedFormulas trait, but I'm getting the error: "You must specify a formula value for a named formula".

If I remove those culprit lines from the name manager it works, but is there any programmatical solution to this problem ?

enter image description here

EDIT: Here is the code

namespace App\Imports;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\WithCalculatedFormulas;  

class ProfitAndLossImport implements ToCollection, WithCalculatedFormulas
{
    /**
    * @param array $row
    *
    * @return \Illuminate\Database\Eloquent\Model|null
    */
    public function collection(Collection $row)
    {
        return $row;
    }
}

and simply calling from controller

Excel::toArray(new ProfitAndLossImport, request()->file('pl')
0 Answers
Related