public DataSet GetExcel (string Path) {// DirectoryInfo parsedirect = new System.IO.DirectoryInfo (Path); // FileInfo [] xlsfile = parsedirect.GetFiles ( "* xls."); OleDbConnection objConn = null; DataSet data = new DataSet (); try {string strConn = "provider = microsoft.jet.OLDB.4.0;" "Data Source =" PATH "; extended Properties = Excel 8.0;"; objconn = new oledbconnection (strconn); ObjconnN.Open (); DataTable schemaTable = objConn.GetOleDbSchemaTable (System.Data.OleDb.OleDbSchemaGuid.Tables, null); string tableName = schemaTable.Rows [0] [2] .ToString () Trim ();. string strSql = "Select * From [ " tableName "] "; OleDbCommand objCmd = new OleDbCommand (strSql, objConn); OleDbDataAdapter sqlada = new OleDbDataAdapter (); sqlada.SelectCommand = objCmd; sqlada.Fill (data," BuyPrice "); objConn.Close () Catch {Objconn.close (); throw;} return data;}