Creating xls sheets from csvs without iterating?

Topics: Developer Forum
Aug 22, 2014 at 4:07 PM
In my app, I have code that generates 5 CSV files from the MySQL OUTFILE command. Is it possible to take those 5 CSV files and create one xls document with 5 sheets (one csv per sheet)?

The CSV files are large (~5000 rows, 10 cols) and I want to know if it's possible to take CSV data and put it into a workbook sheet without looping through the CSV and writing one line at a time. (trying to avoid large memory usage).

Thanks in advance
Aug 22, 2014 at 5:07 PM
It is possible, but looping is more memory efficient than reading an entire CSV file into memory and using fromArray() to inject it into a worksheet in one step.... because you don't have the memory overhead of an entire CSV array in PHP's limited memory.

Ways to reduce PHPExcel memory usage including cell caching are described in the documentation