OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='E://Naresh.xlsx';Extended Properties=\'Excel 8.0';");
OleDbCommand cmd = new OleDbCommand("select * from [Sheet1$]");
cmd.Connection = con;
OleDbDataAdapter dap = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
dap.Fill(ds);
return (ds);
2010..................
OleDbConnection con = new OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;Data Source='E://Naresh.xlsx';Extended Properties=\'Excel 8.0';");
OleDbCommand cmd = new OleDbCommand("select * from [Sheet1$]");
cmd.Connection = con;
OleDbDataAdapter dap = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
dap.Fill(ds);
return (ds);
OleDbCommand cmd = new OleDbCommand("select * from [Sheet1$]");
cmd.Connection = con;
OleDbDataAdapter dap = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
dap.Fill(ds);
return (ds);