Reputation: 11
I am trying to export array data using PHPExcel, for that I am using fromArray Method of PHPExcel. In array there total 5900 records. If I take up to 2600 to array it works fine, but when I increase the size of an array to export using PHPExcel from array it shows an error.
Here is my code:
$objPHPExcel->getActiveSheet()->fromArray($arr, null, 'A6');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="all_sal.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
Upvotes: 1
Views: 1047
Reputation: 558
its a timeout or a memory issue. PHPExcel limit for worksheets size is 65,536 rows and 256 (IV) columns (when using the Excel5 Writer); or 1,048,576 rows and 16,384 (XFD) columns (when using the Excel2007 Writer).
Best alternative to use is PhpSpreadsheet
PhpSpreadsheet is the next version of PHPExcel. It breaks compatibility to dramatically improve the code base quality (namespaces, PSR compliance, use of latest PHP language features, etc.).
Because all efforts have shifted to PhpSpreadsheet, PHPExcel will no longer be maintained. All contributions for PHPExcel, patches and new features, should target PhpSpreadsheet develop branch
or Try changing the memory limit and and timeout as
ini_set("max_execution_time", 'time_limit');
ini_set('memory_limit', '-1');
Upvotes: 2
Reputation: 23
Try changing the memory limit and and timeout as
ini_set("max_execution_time", 'time_limit');
ini_set('memory_limit', '-1');
Upvotes: 2