Simple set up - I have an Excel file which has a column of doubles:
0.94
0.9523
0.9293
The Excel file has this column formatted to be a rounded percentage:
94%
95%
93%
In C#, where I set up an OleDbConnection
to query this Excel file, all my values are returned as:
94%
95%
93%
but I need the actual and unrounded values.
My connection string includes the extended propert开发者_开发问答ies:
...Extended Properties="Excel 12.0;IMEX=1;HDR=No;TypeGuessRows=0;ImportMixedTypes=Text"
but this doesn't seem to do the trick. So my question is, short of changing the Excel document manually to the proper type how can I get this to return the data the way I need it?
I've heard and read about changing the registry, but this isn't the best option as this will be deployed on multiple machines. Is this the only way of doing what I need?
Thanks in advance!
You almost certainly do not want ImportMixedTypes=Text
.
Try it with TypeGuessRows=1;ImportMixedTypes=Majority Types
.
精彩评论