Click here to Skip to main content
13,000,002 members (48,792 online)
Rate this:
Please Sign up or sign in to vote.
See more:
When getting data from excelsheet to C# dataset :
I am using

connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0;IMEX=1;HDR=NO;\"";


connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0;IMEX=1;HDR=NO;\"";

I have to make general formatting for column(s), so that able to update Database as integer column.


12,220 --> 12220
15,445 --> 15445
55,881 --> 55881

Number(-1,234) --> Number(General)

I don't want fix(s) by row (by) row operation

it will degrade performance
Posted 11-Oct-12 0:18am
Updated 11-Oct-12 0:19am
JJ Raj 11-Oct-12 20:53pm
Have you tried string.Format ?
vino2012 12-Oct-12 4:03am
If I am doing string.format, I have to go [row][column]
Expecting performance, Excel sheet contains around 6 Lakhs records

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Formatting has nothing to do with importing data from MS Excel sheet.

Read this: Import Excel File to DataSet[^]

If you use: Provider=Microsoft.ACE.OLEDB.12.0 driver, the Extended Properties can NOT use Excel 8.0 value.

More about it, you'll find at:[^] and[^]
Read carefuly about IMEX option ;)

But, if you got trouble with separator for thousends and decimals, try to manually change it[^] or use CultureInfo (System.Globalization)[^] class to change it programmatically (to imitate other settings).
vino2012 12-Oct-12 4:06am
Thanks, I fixed by removing IMEX=1. Default its IMEX=0 checking first 8 rows of data and it deciding the column type and also removing Excel format.
Maciej Los 12-Oct-12 10:59am
Thank you for accepting solution ;)
If my solution was helpful, please, rate it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 11 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100