How do I create a package that imports an excel file where column names are changing.

Hi,

Our company wants to allow our customers the ability to import employee data. Each customer's employee data changes depending on things like organisation structure etc. so the format of the data to be imported needs to change. We can do a lot of this with dynamic SQL, but are looking at moving it to SSIS as we think it will save us a lot of pain later on and for other features in SSIS.

We're stuck at a fairly early part of the process as we don't know how to dynamically import our spreadsheet. So far our best idea is to connect to the excel connection as the only step in the data task and then to use a script task on the control task, write code to connect to the excel source (set the excel source to not treat the first row as headers so we can do a 'select top 1 *...' ) then create a dynamic sql command to create the table.

Once this is done we would then have another data task that actually puts the data into the newly created table. This all sounds very difficult though. What are the options for doing what we want to do... have a feeling that we're missing something basic.

Any help appreciated,
TIA, Anthony.

[1181 byte] By [AnthonyM] at [2007-12-24]
# 1
Anthony M wrote:

We're stuck at a fairly early part of the process as we don't know how to dynamically import our spreadsheet. So far our best idea is to connect to the excel connection as the only step in the data task and then to use a script task on the control task, write code to connect to the excel source (set the excel source to not treat the first row as headers so we can do a 'select top 1 *...' ) then create a dynamic sql command to create the table.

Any help appreciated,
TIA, Anthony.

What do you mean when you say "dynamically import our sreadsheet"? I do not know the details but if you define a connection manager to your excel file; you don't have to write any other code to connect to it. You can change the properties of your connection manager at run time using package configuration and/or expressions.

Rafael Salas

RafaelSalas at 2007-10-8 > top of Msdn Tech,SQL Server,SQL Server Integration Services...
# 2
Hi Rafael,

Sorry about being vague, I meant what's the best way forward if I have input files that have different sets of columns. I think what I'm discovering as I get more and more into SSIS, if the actual format of the excel files change then I'm really talking metadata here and I'll probably need to either code a custom task or create my packages programmatically. It seems though that SSIS does a lot of good work at design time and it's a shame you can't have some of that happen at runtime. Am I going down the right path or have I missed something obvious?

Regards,
Anthony.

AnthonyM at 2007-10-8 > top of Msdn Tech,SQL Server,SQL Server Integration Services...
# 3
Hi,

In case anyone stumbles across this question, Rafael was very helpful in another thread. The thread below helped me do what I wanted to do. Thanks Rafael!

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=787038&SiteID=1

Anthony.

AnthonyM at 2007-10-8 > top of Msdn Tech,SQL Server,SQL Server Integration Services...

SQL Server

Site Classified