I am generating reports in .xlsx using PHPExcel.There I am getting some speed issues whenever i generate multiple worksheet report. And the same report when i generate with spreadsheet_excel_writer in .xls it takes much less time.
Some of the statistics analysis when comparing multiple worksheet report to single worksheet report with same data(using PHPExcel) are
In my local:
1200 rows in Single Worksheet Report : 10 seconds.
1200 rows in 15 Worksheets Report : 30 seconds.
On Production:
1200 rows in Single Worksheet Report : 24 seconds.
1200 rows in 15 Worksheets Report : 73 seconds.
Don't know why this difference is coming.
Apart from this,I have created the same report using spreadsheet_excel_writer in .xls i.e. the 1200 rows report in 15 Worksheets Report that takes the 6-7 second to generate.
I am using this to create multiple worksheet
while($data = $data_loc->fetchRow()) {
if($check_first_worksheet == 1){ // if it is first worksheet it doesnt create it,just get the activesheet
$objWorkSheet = $objPHPExcel->getActiveSheet();
$check_first_worksheet++;
}
else{
$objWorkSheet = $objPHPExcel->createSheet();
}
}
Am I doing anything wrong ? Please suggest to improve this ?
Also used Mark Baker's Answer to optimize my excel. Anything else i can do ? Please suggest ?