I'm trying to display a excel sheet but i want to exclude Row 1 which is the title and carry on from row 2 which is the start of the info I want.
Currently what i wrote is rather static as you can see I grabbed cells from A2:O36 which is row 2 onwards.But what I want is a dynamic solution that can retrive data from cell 2 till the last entry.Can anyone help?
string connString = "provider=Microsoft.Jet.OLEDB.4.0;data source=" + gotdirectory + @";Extended Properties=""Excel 8.0;HDR=YES;""";
OleDbConnection oledbConn = new OleDbConnection(connString);
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [A2:O36]", oledbConn);
OleDbDataAdapter oleda = new OleDbDataAdapter();
oleda.SelectCommand = cmd;
userTable = ds.Tables;
excelGridView.DataSource = ds.Tables.DefaultView;
excelGridView.ReadOnly = true;