using System.Data.OleDb;
string qry = "Select * from [Sheet1$]";
string excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + _xlsheet_filepath + ";Extended Properties=\"Excel 12.0;HDR=YES;\";Persist Security Info=False";
OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
excelConnection.Open();
DataTable dt = new DataTable();
OleDbDataAdapter exDA = new OleDbDataAdapter(qry, excelConnection);
exDA.Fill(dt);
excelConnection.Close();
No comments:
Post a Comment