Setting up an SSIS package with a dymanic Excel Source

Who is online?  0 guests and 3 members
Home  »  Blogs  »  kylewalker  »  Setting up an SSIS package with a dymanic Excel Source
 
0
/5
Avg: 0/5: (0 votes)

Comments (5)

JEBacaniSQLDude

I think another important take away here is that you can use this for dynamic text sources as well, right?

 

What is also interesting is that another work around could be to use SSIS file tasks to rename source files (MS Excel or otherwise) to fit the prescribed target source.  It's another way of getting the job done, but not as elegant.

 

Mind you, I have yet to try this as I did the workaround instead, and works wonderfully, until the file rename doesn't work.

 

I'll have to try this soon enough.  Thanks for the good tips!

8/25/2010
 · 
 
by
kylewalker
kylewalker said:

Yes, you're absolutely right.  You can use this same method for a flat file source.  I guess I had my blinders on for that one Embarassed.  I haven't actually used the File System Task method either, but it does seem like a viable alternative.  Thanks for your input!  Much appreciated.

8/25/2010
 · 
 
by
SchaffnerC
SchaffnerC said:

As soon as you are going to set up special informations for the Excel File you might get into trouble as I did.

I painfully found out, that there are some mor thingts to take in account:

The Excel Connection string for example:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\ZipCodeExtract.xls;Extended Properties="EXCEL 8.0;HDR=NO;IMEX=1";

If you run over a lot of files you need to replace the Datasource with a variable like  @[User::CM_ImportFileAndPathName]

The Extended Properties are a bit tricky as they have got some "" so I put them also into a variable: @[User::Extended_Properties]

and the Connection Provider: @[User::Con_Provider]

Now all in one like:

@[User::Con_Provider] + "Data Source=" + @[User::CM_ImportFileAndPathName] + ";" +  @[User::Extended_Properties]

-----------------------------------------------------------------

@[User::Con_Provider] = Provider=Microsoft.Jet.OLEDB.4.0;

@[User::CM_ImportFileAndPathName] = C:\ZipCodeExtract.xls

@[User::Extended_Properties] = Extended Properties="EXCEL 8.0;HDR=NO;IMEX=1";

-----------------------------------------------------------------

If you now run a "For each file in... loop container", you are able to apply the correct connection string to your excel file including the additional information how the file should be handled.

9/7/2010
 · 
 
by
DustinRyan
DustinRyan said:

I think its also worth mentioning that SSIS is pretty stingy with the meta data so if you try to upload an excel file that has different column names or a different order you're going to run into problems, so make sure your spread sheet layout is consistent when looping over Excel files.

9/8/2010
 · 
 
by
briankmcdonald

Good post Kyle. I just linked to you for a forum post. It may help Bhavika.

4/12/2011
 · 
 
by
Blogs RSS Feed

kylewalker's latest blog posts

Blogs RSS Feed

Latest community blog posts