xlsx to csv export - memory problem

Topics: User Forum
May 21, 2010 at 2:44 PM

Hi there,

i´m using ver 1.7.3 of PHPExcel on Win XP, PHP 5.2.4 (128MB memory limit), Apache2

i´m trying to convert a xslx file with 1 worksheet, 7 cols and approx. 75.000 rows to a CSV file. There are no calculations, borders, colors etc.

What i´m trying to do is:

require_once 'Classes/PHPExcel/IOFactory.php';
$excel = PHPExcel_IOFactory::load($this->dir."/".$this->d_file);
$excel->setReadDataOnly(true);
$writer = PHPExcel_IOFactory::createWriter($excel, 'CSV');
$writer->save($this->dir."/".$this->d_file.'.csv');

But script runs in memory exhaust error.

Is there a way i can improve this code to use less memory? Some caching options or anything else?

Help would be appreciated.

thx

 

Coordinator
May 26, 2010 at 9:35 AM
bitseeker wrote:
But script runs in memory exhaust error.

Is there a way i can improve this code to use less memory? Some caching options or anything else?

 Yes there is. Please see the myriad of other threads on this topic, and read the section of the PHPExcel Developer Documentation on Cell Caching.

The CSV writer should not be susceptible to any of the memory leaks referenced elsewhere