views:

62

answers:

2

Here's what my connection string looks like..

m_conn = new OleDbConnection(String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=" + (char)34 + "Excel 12.0;HDR=YES" + (char)34, m_fileName));

When I do a select, I only get 65535 rows back but I know the excel spreadsheet has at least 100,000. How Do I read the rest of the rows. Note I have to use OLEDB, no 3rd party tools right now.

Thanks much!

edit: These are Excel 2007/2010 files I'm working with

edit2: Would seem I can actually select all the rows in the spreadsheet if I do a "Select * from worksheet" as opposed to "Select * from worksheet WHERE something"

I guess when you implement a WHERE clause, the resulting rows is capped at 65535

+1  A: 

If you only want to read an Excel file, I recommend trying the open-source Excel Data Reader.

Jay Riggs
+1  A: 

As per my experience, an Excel worksheet is limited to 65535 lines (Excel up to 2003, I don't know about the 2007 version).

EDIT #1

My guess is that the OleDB data provider perhaps needs an update to correct this issue issued from the change of this Excel's limit.

Will Marcouiller
Looks like the limit in 2007 is 1,048,576 rows according to http://www.free-training-tutorial.com/how-to/excel-row-limit.html
Tom
@Tom: Thanks for providing me with this information, that is a nice change that I have never been told about. =)
Will Marcouiller
Tom
Thanks for this information! Perhaps using a `Linq` might help solve the this problem somehow. Only throwing ideas away here. We never know where this can drive us! =P
Will Marcouiller