Try this (change excel path in
connectionstring
OleDbConnection con = null;
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\testExcel.xls;Extended Properties='Excel 8.0;HDR=YES;'";
con = new OleDbConnection(connectionString);
con.Open();
if (con.State == ConnectionState.Open)
{
OleDbCommand cmd = con.CreateCommand();
cmd.CommandText = "Select * from [Sheet1$]";
cmd.CommandType = CommandType.Text;
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataTable table = new DataTable();
da.Fill(table);
}
Once this is done you can use this
datatable
object to put the data anywhere be it UI or any DB table.