Hi All,
I am using PHPExcel library to generate excel data based on mysql datbase. MySql query results in the 1,34,000 rows. And Excel Supports 65,536 Rows on one worksheet. So made logic like
foreach($result as $value) { $val = array_values($value); if($rowscounter < 65000) { $objPHPExcel->addRow($val,$rowscounter); } else { $active_sheet++; $objPHPExcel->createSheet(); $objPHPExcel->setActiveSheetIndex($active_sheet); $rowscounter = 1; } $rowscounter++; } // deliver header header("Content-Type: $mtype; charset=" . $objPHPExcel->sEncoding); header("Content-Type:application/octet-stream"); header("Content-Disposition: inline; filename=\"" . $filename . ".$ext\""); // Save it as an excel 2003 file $objWriter = IOFactory::createWriter($objPHPExcel,$objPHPExcel->sFileFormat); //echo "Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB";exit; $objWriter->save('php://output');
to create new worksheet after 65000 records are reached for one woeksheet.
But it doesn't work; not giving any output or error. Initially I thought its because of memory limit. But when echoed it shows peak memory to 1400.5 MB and I have set my memory limit up to 3500MB using ini_set('memory_limit', '3500M');
Could you please suggest something or any alternative?