Question

I have tried importing a .xlsx file in php using PHP-EXCEL Class. I have been successfull in doing so. But when the excel file increases and the size goes into mbs and records in hundreds of thousands, it generates cell caching problem. Has anybody found solution for this?

Was it helpful?

Solution

Allocate more memory in order to be able to process bigger files.

To do so, you can either do this in php:

ini_set('memory_limit', '64M'); // 64MB is an example (which should be your case anyway), if you currently have 64, set it to 128.

Or directly do that from your php.ini file, by searching the following line:

memory_limit = 64M;

Again, 64M is an example, but it should be your case ;)

If you still experience problems with the memory limit, please increase it again until about 256MB or 512MB (which should be enough for a 10mb XLSx file, if I'm not going wrong).

Also, remember to set the timeout to infinite too, Excel files require usually a lot of time to be elaborated.

Again, you can easily do that either from your php script or from your php.ini file. Here I'm proposing you do that from your php script directly, since you may have other scripts that doesn't need much time:

ini_set('max_execution_time', 0); // 0 => no limit
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top