简体   繁体   中英

Some text Missing in xlsx to text in c# asp.net

I am trying to do .xlsx to text in c# asp.net with Microsoft provider connection string:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;
Extended Properties="Excel 12.0 Xml;HDR=YES;IMEX=1";

Then I am getting all data but the numbers like 12345.34 are converted to 12345. In the same string if I use IMEX=0 then numbers are converted properly but I am not getting the first two rows.

Here is the link of .xlsx file Link

The reason you are not getting the first two rows is not the IMEX option, but the HDR option:

"HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite.

https://www.connectionstrings.com/ace-oledb-12-0/xlsx-files/

Using the connection string below:

Data Source=Data Source=c:\myFolder\myExcel2007file.xlsx;
Provider=Microsoft.ACE.OLEDB.12.0;
Extended Properties="Excel 12.0 xml;HDR=NO;IMEX=1"

and SQL:

select * from [plant_and_fail$]

the result was right numeric data and the first rows: 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM