Link to home
Start Free TrialLog in
Avatar of chlade
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.OLEDB.4.0;" & _
        "Data Source=C:\test.xls;Extended Properties=""Excel 8.0;"""

    Dim cn As New OleDbConnection(ConnectionString)
    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
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium 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