KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Large amount of rows breaks koolreport from generating excel files #2092

Closed Aljaz Ketis opened this topic on on May 19, 2021 - 3 comments

Aljaz Ketis commented on May 19, 2021

I want to create a Report based on some query that is returning a large amount of rows, but it breaks when i run the report $report->run and throws an error regarding allocating memory size, while I have no limit inside php.init file. Inside exception I can see that it breaks on /vendor/koolreport/excel/TableBuilder.php:278, which is for rendering each row inside excel, as soon as i limit the query to 5000 rows it works again. It currently breaks with 280000 rows retrieved from database. Inside the report all i got is a Datatable and on another sheet a PivotTable (for Pivot process i also tried partial_rendering, but no difference).

Sebastian Morales commented on May 19, 2021

If your excel export needs no chart or pivot table you could use Big Spreadsheet export which can export a huge amount of rows without costing too much memory:

https://www.koolreport.com/docs/excel/export_to_big_spreadsheet/

https://www.koolreport.com/examples/reports/excel/big_spreadsheet/

Aljaz Ketis commented on May 19, 2021

I can see, bare tables can be diplayed that way, but we want to display a PivotTable on the first sheet followed by additional sheets for tables.

Sebastian Morales commented on May 19, 2021

Big Spreadsheet export allows for huge export because it streams row by row to the export file. Pivot table or chart require reading and writing for the whole export file and cost a lot of memory.

In your case I suggest you export pivot tables and normal tables to separate files and use this library to merge the them together:

https://packagist.org/packages/infostreams/excel-merge

Let us know if you need any guidance. Tks,

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Excel