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 ConnectionStrings.com....

"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.....
http://msdn2.microsoft.com/en-us/library/ms254500.aspx

Credit, where credit is due....
http://www.dicks-blog.com/archives/2004/06/03/external-data-mixed-data-types/

2 Comments:

At 1:47 PM, Anonymous Anonymous 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