string fileName = "e:\\investigation\\report.xlsx";
string SHEETNAME_HERE = "Sheet1";
string connectionString = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=YES\";", fileName);
OleDbConnection con = new OleDbConnection(connectionString);
StringBuilder stbQuery = new StringBuilder();
stbQuery.Append("SELECT * FROM [" + SHEETNAME_HERE + "]");
OleDbDataAdapter adp = new OleDbDataAdapter(stbQuery.ToString(), con);
DataSet dsXLS = new DataSet();
adp.Fill(dsXLS);
我使用的是 Windows 64 位,而 Office 2010(32 位)找不到可安装的 ISAM。