When using this code for some reason it skips the first line of the csv file, which are the headers. What am I doing wrong?
string strFileName = path;
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " + System.IO.Path.GetDirectoryName(strFileName) + "; Extended Properties = \"Text\"");
conn.Open();
OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM " + System.IO.Path.GetFileName(strFileName), conn);
DataSet ds = new DataSet("Temp");
adapter.Fill(ds);
DataTable tb = ds.Tables[0];
string data = null;
for (int j = 0; j <= tb.Rows.Count - 1; j++)
{
for (int k = 0; k <= tb.Columns.Count - 1; k++)
{
data = tb.Rows[j].ItemArray[k].ToString();
SaturnAddIn.getInstance().Application.ActiveWorkbook.ActiveSheet.Cells[j + 1, k + 1] = data;
}
}