php - exporting large files in separate sheets Laravel Maatwebsite -


i have 50,000 raw. want export them system fails export it. using code. there better solution this?

excel::create('catalogdumptreport', function ($excel) use ($finalarray) {         $excel->sheet('catalogdumptreport', function ($sheet) use ($finalarray) {             $sheet->fromarray($finalarray);             $sheet->setfontfamily('verdana');             $sheet->setfontsize(10);             $sheet->row(1, function ($row) {                 $row->setfontweight('bold');             });             $sheet->setborder('a1', 'thin');             $sheet->setheight(1, 20);         });      })->export('xls')         ->download('xls'); 

personally, advise against expoting such large xls files (directly in browser). best way (and fastest) export in background (such async laravel queue etc.).

there 2 computational complexity problem:

  1. time complexity - grows fast means time download in example severely hrows too.
  2. complexity of memory - can exhaust memory resources on machine can exhaust memory resources on machine fast - means not current system/program can act every other lunched on machine.

as said best way put xle generating in background - there's more:

you need find way split data , append portions of data - not @ once. can save memory resources.

after export in queue can check in browser through ajax request if file ready download , let user dowload prepared xls file.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)