reading excel 2007 returns 255 columns!

H

hkosev

hi,

why I still get result 255 columns as I have approximately 280 in my
test1.xlsx
here is the code used

string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\test1.xlsx;Extended Properties=""Excel 12.0;HDR=YES;""";

string strSQL = "SELECT * FROM [test$]";
OleDbConnection excelConnection = new OleDbConnection
(connectionString);

OleDbCommand dbCommand = new OleDbCommand(strSQL,
excelConnection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter
(dbCommand);

System.Data.DataTable dTable = new System.Data.DataTable
();
dataAdapter.Fill(dTable);
Trace.WriteLine(dTable.Columns.Count.ToString
());
 
D

dk

hi,

why I still get result 255 columns as I have approximately 280 in my
test1.xlsx
here is the code used

string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\test1.xlsx;Extended Properties=""Excel 12.0;HDR=YES;""";

            string strSQL = "SELECT * FROM [test$]";
            OleDbConnection excelConnection = new OleDbConnection
(connectionString);

            OleDbCommand dbCommand = new OleDbCommand(strSQL,
excelConnection);
            OleDbDataAdapter dataAdapter = new OleDbDataAdapter
(dbCommand);

            System.Data.DataTable dTable = new System.Data.DataTable
();
            dataAdapter.Fill(dTable);
            Trace.WriteLine(dTable.Columns.Count.ToString
());


Maximum no. of columns that you can have is 256. What do you mean by
"approximately 280 in my test1.xlsx" ??
 
M

m_asking

dk said:
hi,

why I still get result 255 columns as I have approximately 280 in my
test1.xlsx
here is the code used

string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\test1.xlsx;Extended Properties=""Excel 12.0;HDR=YES;""";

string strSQL = "SELECT * FROM [test$]";
OleDbConnection excelConnection = new OleDbConnection
(connectionString);

OleDbCommand dbCommand = new OleDbCommand(strSQL,
excelConnection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter
(dbCommand);

System.Data.DataTable dTable = new System.Data.DataTable
();
dataAdapter.Fill(dTable);
Trace.WriteLine(dTable.Columns.Count.ToString
());


Maximum no. of columns that you can have is 256. What do you mean by
"approximately 280 in my test1.xlsx" ??
 
M

m_asking

max number of columns that excel 2007 supports is 16k
http://visio.mvps.org/Excel_2007.htm

so I have 280, and when read the sheet - the result is 255. My question is
why?

The total number of available columns in Excel 256 (2^8) 16k (2^14)
dk said:
hi,

why I still get result 255 columns as I have approximately 280 in my
test1.xlsx
here is the code used

string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\test1.xlsx;Extended Properties=""Excel 12.0;HDR=YES;""";

string strSQL = "SELECT * FROM [test$]";
OleDbConnection excelConnection = new OleDbConnection
(connectionString);

OleDbCommand dbCommand = new OleDbCommand(strSQL,
excelConnection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter
(dbCommand);

System.Data.DataTable dTable = new System.Data.DataTable
();
dataAdapter.Fill(dTable);
Trace.WriteLine(dTable.Columns.Count.ToString
());


Maximum no. of columns that you can have is 256. What do you mean by
"approximately 280 in my test1.xlsx" ??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top