I Have Done this For datagrid am not sure whether the same coding vl work for the gridview,just have a try.
After Selecting the needed excel file and in a button click try this code,
ExcelFile.PostedFile.SaveAs(Server.MapPath(".\\Somepath "\\") + "FileName(Fixed).xls");
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + Server.MapPath(".\\Somepath "\\") + "FileName(Fixed).xls;" +
"Extended Properties=Excel 8.0;";
System.Data.OleDb.OleDbDataAdapter mydata1 = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);
mydata1.TableMappings.Add("Table1", "ExcelTest1");
mydata1.Fill(FileName(Fixed));
datagrid1.DataSource = FileName.Tables[0].DefaultView;
rowcount = FileName.Tables[0].Rows.Count;
datagrid1.DataBind();
Amritha444, if this helps please login to Mark As Answer. | Alert Moderator