I'm trying to read the content of an excel file (I must process the data not show it) but the number of rows is 0. I did show the data in the UI and the rows didn't have a number.
string src = "the path;";
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + src +
"Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"");
OleDbDataAdapter da = new OleDbDataAdapter("select * from [RENNES4_wk13$]", con);
DataSet ds = new DataSet();
da.Fill(ds);
DataGridView dgv = new DataGridView();
dgv.DataSource = ds.Tables[0];
int rows = dgv.Rows.Count;
int cells = dgv.Rows[0].Cells.Count;//ArgumentOutOfRange why?
How do I fix it?