Takes too long to download Excel5

Topics: Developer Forum, User Forum
Dec 15, 2010 at 3:55 PM

Hi, I have a php script that downloads data to xls. I am using PhpExcel 1.7.4 to do the download. My problem is that, it takes at most 30 mins before I can download the file. I also added an image to the file. When I got the downloaded file, it has 900 rows and 24 columns. Any help would be much appreciated as I badly needed the solution for this one. Thank you very much.

Dec 15, 2010 at 11:40 PM

There are a lot of discussions among the threads here that describe how to create workbooks more efficiently - for example, using ranges or row/column styles rather than setting each cell's style individually. Version 1.7.5 is also faster than the version you are currently using. If you need anything faster than that, then I suggest you look at commercial solutions such as libXL with Ilia Alshanetsky's PHP_Excel extension, or COM if you're running on a Windows server.

Dec 16, 2010 at 8:08 AM

Is it possible that the writer may cause this bug? Because I am only using setCellValueByColumnAndRow function for inserting data to sheet's rows and columns.

Dec 16, 2010 at 12:24 PM

Yes it is the Writer, and no it's not a bug. It's simply a matter of performance; a bug would be when the file generated contains wrong information. Version 1.7.5 has been heavily optimised to improve speed, but it can never be instantaneous. While 30 minutes is an excessive time for a small worksheet, there is little more that we can do to speed things up without rewriting in C or similar.

Dec 17, 2010 at 10:21 AM

It's much better now. I am using Excel2007 Writer. I set $objWriter->setPreCalculateFormulas(false) because by default, this writer pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets. Thanks for the reply, but I got another issue now, it's about inserting image on excel file. Please refer to this discussion, http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=238728. Thanks again.