PHPExcel creating extra column/s

Topics: Developer Forum
Nov 11, 2009 at 12:38 AM
Edited Nov 11, 2009 at 12:45 AM

I am generating an excell spreadsheet on an IIS5 server with a php5 install- php excell @version    1.6.3, 2008-08-25
Everything works fine but the spreadsheet has an extra column when generated. I have scoured my code and am definately not setting this column anywhere.
So I guess my question is - is this normal? if so how do i stop it, if not does anyone have any idea what is going on?

The generated excell file is submitted as an application to another system which will not allow any extra columns so I need to fix this.

I have done some testing and it seems the writer always adds one extra column- is this standard behaviour?
Can I turn it off, or can I delete the extra column somehow?

Any help much appreciated!

Developer
Nov 11, 2009 at 12:44 AM

Are you using PHPExcel 1.6.3 ? Is it likely that upgrading to latest version of PHPExcel will fix this.

Nov 11, 2009 at 12:46 AM

Yes I am. I will upgrade now.

Can I delete a column though?

Nov 11, 2009 at 12:53 AM

Just upgraded to @version    1.7.1, 2009-11-02

didnt fix the problem... any ideas?

Developer
Nov 11, 2009 at 12:57 AM

Can you upload a sample Excel file and explain where you see this extra column? I'm not sure what you mean.

Please upload the Excel file here:

http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=10749

Nov 11, 2009 at 1:05 AM

Done.

Thanks for helping with this.

 

Developer
Nov 11, 2009 at 1:33 AM

I may understand what you mean now. This is only happening with Excel5 writer, not Excel2007 writer, right?

We have this work item describing the problem. There are actually 256 columns, not just 1 extra.

http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=10861

To figure out a solution, can you tell me how your application sees that there is an extra column? What is exactly the problem when you submit the Excel file to that application?

Nov 11, 2009 at 1:43 AM
Edited Nov 11, 2009 at 1:44 AM

No it is happening with excel2007 writer also, I only just this morning changed the writer to excel5.

I dont know how the application sees the xtra column as I dont have access to that side of things (this excell doc. is submitted to a federal agency system for airport security clearance cards).

Below are the rules stipulated for the excell file:

the Excel file must conform to the following format/usage rules:

File Type

The file must be an Excel spreadsheet (.xls)

‘Data’ worksheet

The spreadsheet must contain a worksheet named ‘Data’

Number of columns

141 or 142 (depending on existence of ‘VisaExpiryDate’ column)

Maximum number of rows

250

Maximum file size

5120 KB

 

how do I limit the number of **COLUMNS, ? is this possible? - editeed... sorry typo

Developer
Nov 11, 2009 at 1:54 AM

I can't believe that the Excel file is rejected because of the extra columns? Do you get a specific error message saying that there are too many columns?

Maybe a stupid question, but have you tried if the system you are submitting to accepts Excel files created in e.g. MS Office Excel, or OpenOffice.org Calc ?

Nov 11, 2009 at 2:13 AM


I know its stupid, its a government department so they dont care- its either their way or the highway.
If there is 256 columns that means it is only hiding the other columns then, but they are still there- that would be throwing the whole thing out.

I am rebuilding an online applications system and it accepts the 2003 excell files from the old system (generated using ASP so its probably microsoft compliant).

I dont know what I am going to do then. Any ideas?

Nov 11, 2009 at 2:32 AM

**I think** I can work around this by loading an example template that is supplied to developers and adding data to it and saving it again.

Developer
Nov 11, 2009 at 2:33 AM
Edited Nov 11, 2009 at 2:34 AM

>> Any ideas?

Can you check if the system accepts this file:

application_id_84_excell_03-saved.xls

It is the same file as you uploaded, but I did a plain save in MS Office Excel 2007.