Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

writing data from Table to Excel files in Loop based On a condition Expand / Collapse
Author
Message
Posted Wednesday, April 10, 2013 8:51 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, July 24, 2013 10:58 AM
Points: 2, Visits: 31
HI,

I am trying to load the data from table to Excel files.
I have 5 folders, each folder has an exel file called "Excel Upload.xlsx".

I need to write data into each of the excel file(into one of the sheet) based on one condition.

If the prefix of one of the ID in the table matches prefix of folder name then write that data back to that particular folder.
Ex: ID: "GARNIER SHAMPOO" then write back to \\servername\e$\Data\MDP_76_02\Inbound\Excel Upload\Garnier\excel upload.xlsx

I am facing issues while doing this, Can any one please provide me an approach.
Post #1440860
Posted Wednesday, April 10, 2013 12:06 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, April 10, 2014 10:17 AM
Points: 7,070, Visits: 12,522
Data Flow Task containing:

1. OLE DB Source that selects the data you need to export as a single resultset, i.e. a SELECT statement
2. Conditional Split that evaluates the ID column and creates 5 output streams based on the 5 folder prefixes you mentioned
3. Have an Excel Destination connected to each of the output streams that writes the data into the Excel sheets you mentioned.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
Post #1440969
Posted Wednesday, April 10, 2013 12:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, July 24, 2013 10:58 AM
Points: 2, Visits: 31
Thank you for the reply.
Since I am writing to 5 Different folders, I need to create 5 differnt Excel destination connections.
I would like to have a solution to get a foldername dynamically and match to prefix of the ID. I don't want to create multiple Excel connections. Can you please give a solution to achieve this.
Post #1440975
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse