here you go
pre requisite- Install AccessDatabaseEngine 2007 or 2007
try
{
string path;
oledbConn =
new OleDbConnection(
@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path
+ ";Extended Properties='Excel 12.0;HDR=YES;IMEX=1;';");
oledbConn.Open();
var cmd = new OleDbCommand();
var ds = new DataSet();
cmd.Connection = oledbConn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELEet1$]"; Name of sheet
var oleda = new OleDbDataAdapter(cmd);
oleda.Fill(ds);
foreach (DataRow row in ds.T??les[0].Rows)
{
}
catch (Exception ex)
{
}
finally
{
oledbConn.Close();
}