PHPExcel very slow - ways to improve?

后端 未结 8 1379
孤街浪徒
孤街浪徒 2020-12-07 13:28

I am generating reports in .xlsx using PHPExcel. It was okay in the initial testing stages with small data sets (tens of rows, 3 sheets), but now when using it on a real pro

8条回答
  •  执念已碎
    2020-12-07 14:15

    For a XLSX export with columns a - amj (~800) and only ~50 rows I also ran into the 30 second boundary. To test my program, I limited the amount of rows processed to just 7, which worked in 25 sec.

    1. going from individual $objPHPExcel->getActiveSheet() to $sheet (first advice) it actually increased the time on a limited amount of rows from 25 sec to 26 sec.

    2. What really helped me was replacing all my getHighestDataColumn() with a simple $column_nr variable that is incremented in PHP, I went from 26 sec to 7 sec.

    After that I was able to process all 50 rows in 11 sec.

提交回复
热议问题