on-internet
← Community

export large data with chunk in Laravel-Excel

Stack Overflow ·

With this code I can export to excel the data of MyModel, works ok: Excel::create('Filename', function ($excel) { $excel->sheet('Contratos', function ($sheet) { $datos = MyModel::select([ 'id', 'data']) ->get(); $sheet->fromArray($datos, null, 'A1', false, false); }); })->export('xls'); But I need to chunk the data to generate the excel, because in another model I have too much data (like 9000 records). I was seein some examples like this one: http://www.thecreativeroad.com/blog/export-large-dataset-using-laravel-excel-using-laravel-db-chunk $data = $user->query(); try{ return Excel::create('F

Comments

Sign in or sign up to comment and upvote.

No comments yet.