I am using Laravel Excel 2.1. I have an array of data that I want to add as a new sheet to an existing excel file and save it locally.
Here is the code I am trying
Excel::load(base_path() . '/storage/app/surveyFilters/' . $surveyFilter->filename, function($file) use($data) {
$file->sheet('Individuals - Tagged', function($sheet) use($data)
{
$sheet->fromArray($data);
});
})->store('xls', public_path('assets'));
I get this error "Call to a member function fromArray() on null". If I var_dump $data right before the call and exit it shows my array so $data is not null. I also tried with() instead of fromArray() but get similar error message.
Any help would be appreciated.