chlade
asked on
Excel OLEDB - start row
Is there a way to specify a "start row" when using OLEDB to read an Excel file? The code below works just fine if I have a header on line 1 and data starting on row 2. However, my data will have miscellaneous information on lines 1 and 2, a header on line 3, and data starting on row 4.
Is there a way to indicate this in the Connection String?
Thanks,
Chris
Dim ConnectionString As String = "Provider=Microsoft.Jet.OL EDB.4.0;" & _
"Data Source=C:\test.xls;Extende d Properties=""Excel 8.0;"""
Dim cn As New OleDbConnection(Connection String)
cn.Open()
Dim ds As New DataSet
Using cmd As New OleDbCommand("SELECT * FROM [Sheet1$]", cn)
Dim da As New OleDbDataAdapter(cmd)
da.Fill(ds, "Sheet1")
End Using
Is there a way to indicate this in the Connection String?
Thanks,
Chris
Dim ConnectionString As String = "Provider=Microsoft.Jet.OL
"Data Source=C:\test.xls;Extende
Dim cn As New OleDbConnection(Connection
cn.Open()
Dim ds As New DataSet
Using cmd As New OleDbCommand("SELECT * FROM [Sheet1$]", cn)
Dim da As New OleDbDataAdapter(cmd)
da.Fill(ds, "Sheet1")
End Using
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.