PHPExcel very slow - ways to improve?

后端 未结 8 1396
孤街浪徒
孤街浪徒 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 13:59

    I had the exact same issue. Got a 5000 row, 32 column CSV file that took forever to process. It turns out almost all the time spent "processing" is actually the character encoding which is set to encode everything to UTF8 by default. So if you go into your config\excel.php file and scroll down to encoding, just set it as:

    /*
    |--------------------------------------------------------------------------
    | Import encoding
    |--------------------------------------------------------------------------
    */
        'encoding' => array(
    
            'input'  => '',
            'output' => ''
    
        ),
    

    With this alone - the above mentioned file takes around 8sec to process. You might want to warn your client to save the CSV correctly though.

提交回复
热议问题