title: Importing from CSV file, how to skip first X rows
body: <p>I am writing an application to process and upload a <code>csv</code> file to a remote server.
  The application needs to be fairly flexible, allowing custom mappings of columns.</p>
  
  <p>The first big hurdle I've come to is with reading the file, many of the files have the data starting at row 5+ with some junk data at the top, example below:</p>
  
  <pre><code>Account: 123
  ----------
  Date: 15/12/2011
  ----------
  Type: Full
  ----------
  Column1,Column2,Column3,Column4
  Data1,Data2,Data3,Data4
  Data1,Data2,Data3,Data4
  </code></pre>
  
  <p>Ideally I'd like a way to pick up the first line of data but this might be tricky.</p>
  
  <p>I'm connecting to the file using Jet with the connection string:</p>
  
  <pre><code>If (_extension = ".csv") Then
  
                  _excelconn.ConnectionString = String.Format( _
                      "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}" &amp; _
                      "; Extended Properties=""text;HDR=No;FMT=Delimited""", _directory)
  
  End If
  </code></pre>
  
  <p>Then getting data via the code:</p>
  
  <pre><code>If ValidateAll() Then
              Try
  
                  ConnectExcel() ' Opens connection to csv/excel file
  
                  _excelcommand.CommandText = "SELECT * FROM [" &amp; _excelsheets(_selsheet) &amp; "]" ' Currently selected sheet, returns SELECT * FROM [1234#csv]
                  _excelcommand.Connection = _excelconn
  
                  _reader = _excelcommand.ExecuteReader()
  
                  While _reader.Read()
  
                      'MsgBox(_reader(0).ToString)
                      'Dostuff
  
                  End While
  
              Catch ex As Exception
                  _errors.Add(ex.ToString)
                  retval = -1
              End Try
  
  
          End If
  </code></pre>
  
  <p>This is falling over with an exception as I can't access <code>reader(2)</code> for the first lines.</p>
  
  <p>Is there any way in the connection string or in the <code>SELECT</code> statement to tell Jet to skip the first X rows of the sheet?
  If not is there a way to only process the <code>reader.Read()</code> if the row number is higher than X?</p>
  
  <p>I know it's probably possible with reading the entire file to an array and parsing from there or by copying the file contents to a new csv file but if there is a way to avoid that and do it through jet/ado then I'd much prefer that!</p>
  
  <p>(tagged <code>sql</code> as there might be an <code>sql</code> solution in the ado query)</p>