Fatal error when creating xlsx with more than 130 columns

Topics: Developer Forum, Project Management Forum, User Forum
Jul 3, 2013 at 9:48 PM
Edited Jul 4, 2013 at 9:41 PM
Hi, I'm using a php script to create an xlsx file from an sql database everyday.
My suppliers upload their prices into my database and I generate an xlsx file with their data at the end of the day. Sometimes I get a fatal error message. I searched for the cause and found out that the fatal error occurs everytime the output-file would consist of more than 130 columns due to the size of the database. When I delete the corresponding surplus data of the user uploads inside the database and start the file-creation script again, then everything works fine, the file gets created.

I don't know if there maybe a problem with any limitation of my server, or if there is any limitation within my script or if there is a limitation with PHPExcel.. Maybe someone can tell me, so I can increase any value anywhere and create xlsx files with more than 130 columns..

The Output file consists of the following columns: A - Item-no, B - Vendor-id, C - Name of product, D - quantity (the first 4 Columns are always that way, they are fix. Then the uploaded data of the users are added 3-column-wise: E - Price (Headline Name of user), F - Quantity (the quantity he has on stock), G - Infos regarding the item, H-J next user data, K-M next user data and so on, till column DZ (130), when there's more in the database than that, the following fatal error occurs. That means, only 42 Users (126/3) can upload their data, if it were 43, the output-creation crashes.

Here's the fatal error message I get:

Fatal error: Uncaught exception 'PHPExcel_Exception' with message 'Invalid cell coordinate 1' in /usr/www/users/markusj/anfrage/includes/PHPExcel/Cell.php:546 Stack trace: #0 /usr/www/users/markusj/anfrage/includes/PHPExcel/Worksheet.php(1134): PHPExcel_Cell::coordinateFromString('1') #1 /usr/www/users/markusj/anfrage/includes/PHPExcel/Worksheet.php(1042): PHPExcel_Worksheet->getCell('1') #2 /usr/www/users/markusj/anfrage/includes/class.user.php(583): PHPExcel_Worksheet->setCellValue('1', 'Built') #3 /usr/www/users/markusj/anfrage/controller/default.php(133): USER->getResult() #4 /usr/www/users/markusj/anfrage/controller/default.php(65): FWDefaultController->result() #5 /usr/www/users/markusj/anfrage/start.php(20): FWDefaultController->__construct('result') #6 /usr/www/users/markusj/anfrage/tmpl/header.php(1): include('/usr/www/users/...') #7 /usr/www/users/markusj/anfrage/index.php(1): include('/usr/www/users/...') #8 {main} thrown in /usr/www/users/markusj/anfrage/includes/PHPExcel/Cell.php on line 546

I'm using the newest version of PHPExcel. My server runs PHP 5.3, SQL Database 5.1. Maybe someone can help me with that..

Thanks in advance,

Jul 4, 2013 at 7:37 AM
According to the error message, the coordinates of the cell are incorrect (just "1" something of the form "A1" is expected).
I guess that your script has a concern to determine the column when there are more than 42 users.
Jul 4, 2013 at 9:40 PM
Edited Jul 6, 2013 at 6:43 AM
Hi LWol,

thanks for your advice, I found the mistake. In one of the files (class.user.php) an array gets created from A to DZ. I extended it to GZ, now it works fine! :-)

Thank you very much!