Saturday, November 12, 2005

Excel data not coming into SSIS right?

So sometimes you have data that does not come up right in Excel because either it's not formatted, or it's got mixed types. The end of it all is you just need it to come in as text and you can convert it later. My good friend, Robert Skoglund gave me this hint and I dug up some info on it....

Basically, add the option IMEX=1 to the ConnectionString for Excel. This forces the columns to be treated all as text.

This from

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
"HDR=Yes;" indicates that the first row contains columnnames, not data
"IMEX=1;" tells the driver to always read "intermixed" data columns as text
TIP! SQL syntax: "SELECT * FROM [sheet1$]" - i.e. worksheet name followed by a "$" and wrapped in "[" "]" brackets.

From Microsoft.....

Credit, where credit is due....


At 1:47 PM, Anonymous Vadim said...

This is really helpful tip!
I wasted so much time trying to load mixed data from Excel into SSIS, playing with different settings in Excel and SSIS, converting into CSV, etc., but never got it right. Now the transformation just flies!
Thanks a lot!

At 4:07 PM, Anonymous Anonymous said...

Good one. Thanks.


Post a Comment

<< Home