Link to home
Start Free TrialLog in
Avatar of Jedidia
JedidiaFlag for United States of America

asked on

Select specific rows within Excel

I have the following select

MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection)

How would I configure the select statement to start on a specific row (say row 14) and go until the there were no more rows with data?

Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

You can do that like this....

    MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$14:65536]", MyConnection)

Wayne
Avatar of Jedidia

ASKER

Hi Webtubbs - This works great for starting at row 14, but is there also a way to identify the last row with data and the select stops at that row?

I am passing this to a datatable and it adds ALOT of empty rows in my datatable..:)
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial