Please I need quick help. Am trying to import a large excel file in chunk using this code as per the documentation:
Excel::filter('chunk')
->load('file.csv')
->chunk(250, function($results)
{
foreach($results as $row)
{
// do stuff
}
});
However, I am getting this error which I can’t understand.
Call to undefined method MaatwebsiteExcelExcel::filter()
I have checked everywhere online and can’t find the same error anywhere. Where am I going wrong?
2
Answers
Seems like the
Excel::filter('chunk')
is removed in version 3.1 See the changelog here:Also
Excel::load()
is removed. So you can useExcel::import(..)
, and it should work.Please, implement the interface
WithChunkReading
. And return the chunkSize (in bytes) from the method namedchunkSize
. For example:And call the import method like below from your controller method:
N.B: This should work from the laravel-excel version 3.1