string path = FileUpload1.PostedFile.FileName;//Here i use Fileupload control in DOTNET2005 OleDbConnection con; System.Data.DataTable dt = null; //Connection string for oledb string conn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + path + "; Extended Properties=Excel 8.0;"; con = new OleDbConnection(conn); try { con.Open(); //get the sheet name in to a table dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); String[] excelsheets = new String[dt.Rows.Count]; int i = 0; //using foreach get the sheet name in a string array called excelsheets[] foreach (DataRow dr in dt.Rows) { excelsheets[i] = dr["TABLE_NAME"].ToString(); i++; } // here i manaually give the sheet number in the string array DataSet ds = new DataSet(); foreach (string temp in excelsheets) { // Query to get the data for the excel sheet //temp is the sheet name string query = "select * from [" + temp + "]"; OleDbDataAdapter adp = new OleDbDataAdapter(query, con); adp.Fill(ds,temp);//fill the excel sheet data into a dataset ds } gd.DataSource = ds;//finally bind the Data into the grid gd.DataBind(); } catch (Exception ex) { Response.Write(ex.Message); } finally { con.Close(); }