I'm being presented with a CSV file that i would like to import to a datatable. The challenge I have is that the file has 2 different delimters. The first few columns are delimited with a "tab" and the rest with a";". I can handle the one easily but not sure how to handle both. The code that I have so far but struggling to find a way to expand this to import it the single step:
Public Function LoadFileToDatatable(ByVal FullFilePath As String)
'Load the Testfile into an datatable
Dim folder As String = System.IO.Path.GetDirectoryName(FullFilePath)
Dim filename As String = System.IO.Path.GetFileName(FullFilePath)
Dim con = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & folder & ";Extended Properties=""text;HDR=No;FMT=Delimited"";"
Dim dt As New DataTable
Using Adp As New OleDbDataAdapter("Select * From " & filename, con)
Adp.Fill(dt)
'Remove the first row as it contains the header data
Dim theRow As DataRow = dt.Rows(0)
dt.Rows.Remove(theRow)
End Using
Return dt
End Function