String strConn="Provider=Microsoft. ACE. The OLEDB. 12.0; Data Source="+" F: \ \ test1 XLSX "+". Extended Properties='Excel4.0; HDR=NO. IMEX=1 '";
The DataSet ds=new DataSet ();
OleDbDataAdapter oada=new OleDbDataAdapter (" select * from [Sheet1 $] ", strConn);
Oada. The Fill (ds);
!!!!!!!!! Turn to
CodePudding user response:
Connection excel using access database engine. It contains the relevant ODBC and oledb driver, you need to install the access database engine:https://www.microsoft.com/zh-CN/download/details.aspx? Id=13255CodePudding user response:
Upstairs is feasible,But there is another way to use COM + development, directly ApplicationClass object to be obtained, and then save the data, also can set the CELL style or something at the same time, more powerful,
CodePudding user response:
4.0 to 12.0CodePudding user response:
Extended Properties='Excel12.0