INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

SSIS Read Excel rows and create new output file

SSIS Read Excel rows and create new output file

(OP)
Hi,

I have an excel file with following data:

Agent State Exposure Insured Name
Rogers Inc MA 100,000 John Smith
SAN Group RI 200,000 Jim Morrison
SAN Group RI 100,000 Jimi Hendrix
123 Agency MA 300,000 Mickey Mouse
Rogers Inc MA 50,000 Mike Greenwell

I want to be able to read the file and create new excel files for each Agent listed.

So for Example, the above file would create 3 separate files since there are 3 different Agents listed. Each Agent file would contain the same information from the original file. The name of the file would be somethign like AgentName.xls

So the SAN group file would have this:

Agent State Exposure Insured Name
Rogers Inc MA 100,000 John Smith
SAN Group RI 200,000 Jim Morrison
SAN Group RI 100,000 Jimi Hendrix

Is there a way to accomplish this in SSIS?

thanks
Scott

RE: SSIS Read Excel rows and create new output file

I would:

Read the file into a table in your database as is

Select distinct agents using SQL Query into a variable of type object (from your newly populated table)

Set up a for each loop using the object variable as the container (this will loop through the distinct list of agents

Assign an appropriate variable in the loop to hold your agent

Set up a DFT in the loop to:
select details from your newly populated table with a WHERE clause using your variable agent name to restrict the results
Use an excel destination object to output the results to a file - the connection can be made dynamic to pick up the agent name from teh variable you have populated

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244: How to get the best answers before you ask a question

RE: SSIS Read Excel rows and create new output file

(OP)
thanks Geoff,

This sounds logical to me. The trickiest part will be to dynamically have the excel file name change, but I should be able to find some examples of that online.

thanks
Scott

RE: SSIS Read Excel rows and create new output file

you should be quite easily able to create a variable destination

simply set the connectionstring property of the connection to an expression and have it pick up 1 or 2 variables from the package (base file path and agent name spring to mind)

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244: How to get the best answers before you ask a question

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close