Excel Read - Column Limit

Hi,

Thanks for reading the post!

I am trying read an excel file which has more than 255 columns. The code I have used is as follows:

adoFields = rs.fields();
for (col = 0; col < adoFields.count(); col ++)
myMap.insert(indexCnt, adoFields.itemIdx(col).value());

but “rs.fields();” does not read more than 255 columns… And when I change the code to

adoFields = rs.fields();
for (col = 0; col < 1000; col ++)
myMap.insert(indexCnt, adoFields.itemIdx(col).value());

it gives error as “Method ‘item’ in COM object of class ‘Fields’ returned error code 0x800A0CC1 () which means: Item cannot be found in the collection corresponding to the requested name or ordinal.”

Any alternate way to get achieve it?

Anyone???

Any suggestion?

Hi Abinay,

I am also facing the same problem for reading columns more than 256 columns…

If you get some solution also please let me know.

you might be using ado classes but i am using SysExcel classes to read excel there also i am getting same issue of 256 column limit.

Regards,

Geetika

AS per your code which i have checked.

you are getting this error because your code might not be able to find the row count.

Regards,

Geetika

Hi Geetika,

The row count does not matter, it gives error when I hard code the value as 1000.

Hi Geetika,

I am also trying SysExcel Class, but I dont know how to get the total no. of columns.

like Abhinay has done trough “adoFields.count()”. How do we calculate number of columns in SysExcel Class.

Hope you get it what I am asking. Plz reply me as soon as you get it.

Thank you.

Hi,

I found this bit from here: http://techstack.com/forum/microsoft-dynamics-ax/65796-import-more-than-256-column.html

The column limitation for an AX 4.0/SQL Server 2005 table is 1,024, and Excel 2007 has a limit of 16,382 columns. But, it sounds like you are
either saving the 2007 Excel file in 2003 format, which has a limit of only 256 columns, or AX is seeing the file as a 2003 format and chopping at 256.
AX 4 was created well before Excel 2007 and it probably was just not designed beyond the Excel 2003 limit.

Bit of old message that, but is your Excel saved in an old format by any chance?