Take the 2-minute tour ×

Can any one please let me know, why this following error has been thrown from PHPExcel classes

 /var/www/mydomain/myexcel.xlsx.' in /var/www/mydomain/Classes/PHPExcel/Writer
/Excel2007.php:400 Stack trace: #0 /var/www/mydomain/myexcel.php(173):
 PHPExcel_Writer_Excel2007->save('/var/www/mydomain...') #1 {main} 
thrown in /var/www/mydomain/Classes/PHPExcel/Writer/Excel2007.php on line 400
share|improve this question
"PHPExcel" as in phpexcel.codeplex.com ? –  VolkerK May 19 '10 at 7:20
Not wothout more detail, and probably tracing through your code/workbook. Assumption PHPExcel 1.7.2 –  Mark Baker May 19 '10 at 7:55
add comment

4 Answers

up vote 2 down vote accepted

I hope this exception may occur because of the Excel sheet is still in open state. also please check with the permission of the folder in which you write/save/upload the .xlsx file.

share|improve this answer
yes the file extension is wrongly given –  Chakrapani May 21 '10 at 14:24
add comment

My educated guess would be that this is due to the fact that the permissions on the folder you're trying to write to are wrong. If that's the case, either make the folder writable (which, from the looks of it would be a bad idea) - or try to save to a location where the web user has write access to solve the problem.

BTW What version of PHPExcel are you using?

share|improve this answer
Thanks for the idea: I'll run some tests... might then be able to do a permissions test before writing and throw a more meaningful exception –  Mark Baker May 19 '10 at 15:37
add comment

The most likely cause of this error is that you do not have permission to write to the directory you're trying to save the Excel file to.

share|improve this answer
add comment

The exception is being thrown because PHPExcel has opened the zip file for writing the Excel workbook; but when it tries to close it again on completion, the zip library method call to close() has failed. Why it has failed is the real problem, and that can't be resolved simply by knowing the error message.

share|improve this answer
add comment

Your Answer


