I have some memory issues when writing xls (xlsx) files with PhpExcel. I have tried to use the cache but it does not seem to work when writing new documents.
$cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_phpTemp;
$cacheSettings = array( 'memoryCacheSize' => '8MB'
);
PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
After an library update to current version (v1.8.1) the problem have improved a bit but still I am able to prepare and export only a file with 8 columns and 15000 - 20000 rows (20000 rows with cache_in_memory_gzip) without increasing the memory limit. Unfortunately in my case this is not sufficient solution.
Cache method can maybe allow me to prepare more entries ahead but during the actual write method nothing seems to matter.
$file = new PHPExcel();
// Prepare data ...
$writer = PHPExcel_IOFactory::createWriter($file, 'Excel2007');
$writer->save($pathname); // More memory required
At the end we have switch to box/spout. I can not claim that I have tested its full capabilities but I have got bored after 800 000 rows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With