yajra / laravel-datatables

jQuery DataTables API for Laravel
https://yajrabox.com/docs/laravel-datatables
MIT License
4.76k stars 858 forks source link

How to export excel with big data #819

Closed kieuminhcanh closed 7 years ago

kieuminhcanh commented 7 years ago

I have a table with > 100.000 record. Display 100 records per page. I was added Excel button. But it just export current page with 100 records. Any way to export all data?

Because this is very big table, so I think we need a ajax function to request data step by step and then merge to download, right?

Please, help.

yajra commented 7 years ago

The package uses laravel-excel when exporting csv, xls & pdf. You can override the excel() method and maybe try chunking the results.

muhamed-didovic commented 7 years ago

Hi @yajra, I managed with chunking to reduce time and solve problem with memory when building Excel or CSV, but PDF creation is really slow, do you have any advice how to speed it up?

yajra commented 7 years ago

@muhamed-didovic have you tried using snappy as the pdf generator? See this doc for ref.

Maybe you can also try chunking the results on print template that snappy will use when generating the PDF?