public static DataTable GetExcelData(string strFile) { DataTable dttblExcelData = new DataTable(); try { string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFile+ ";" + "Extended Properties='Excel 8.0;IMEX=1'"; OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [" + strFile+ "]", strConn); myCommand.Fill(dttblExcelData); } catch (Exception e) { string errMsg = e.Message.ToString(); } return dttblExcelData; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)