DataTable dt = new DataTable(); conString = string.Format(conString, excelFile); using (OleDbConnection connExcel = new OleDbConnection(conString)) { using (OleDbCommand cmdExcel = new OleDbCommand()) { using (OleDbDataAdapter odaExcel = new OleDbDataAdapter()) { cmdExcel.Connection = connExcel; connExcel.Open(); DataTable dtExcelSchema; dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); connExcel.Close(); //Read Data from Specific Sheet And Range connExcel.Open(); cmdExcel.CommandText = "Select * from [" + "5.2" + "$A6:R100000]"; odaExcel.SelectCommand = cmdExcel; odaExcel.Fill(dt); connExcel.Close(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)