COPY XL SPREADSHEET FROM ONE XL WORKBOOK TO ANOTHER IN LOOP ?

  • Here is my situation (looking for a way to accomplish this task via SSIS)

    400 Excel files ftp-arrive daily to 2 directories : DIR1 and DIR2
    There are 400 files in each directory, 1 file per Agency.

    Each file in Dir1 and Dir2 is named THE SAME WAY:  < ‘ AgencyInfo’ + ‘_’+  @AgencyNumber + ‘.xlsx’ >
    In Dir1 they are all called
    AgencyInfo_123.XLSX
    AgencyInfo_124.XLSX
    AgencyInfo_125.XLSX
    //………………..//
    Etc.
           (three digits at end of file name is Agency Number)

    In Dir2 they are all called
    AgencyDetails_123.XLSX
    AgencyDetails_124.XLSX
    AgencyDetails_125.XLSX
    //………………..//
    Etc.

    AgencyInfo% files in DIR1  have 3 spreadsheets each, and AgencyDetails% files in DIR2  have 5 spreadsheets.

    TASK that I need to accomplish
    (using ANY method that I can call from ANY SSIS TASK) :
    -->  Copy Spreadsheet #2 from AgencyDetails% files into AgencyInfo% files  (insert it as spreadsheet #4, to the end of other 3 spreadsheets).
    So
    --> Spreadsheet #2  from AgencyDetails_123.XLSX  will be added into AgencyInfo_123.XLSX  file                 (not touching existing spreadsheets in it)
         Spreadsheet #2  from AgencyDetails_124.XLSX  will be added into AgencyInfo_124.XLSX  file
         Spreadsheet #2  from AgencyDetails_125.XLSX  will be added into AgencyInfo_125.XLSX  file 
    ETC., for all 400 files.

    How can I possibly do it in an SSIS Package?

    Likes to play Chess

  • If you are prepared to install Excel on the server where SSIS is running (I wouldn't), it should be possible using the Sheet.Copy method – in a script task.

    Not pretty and it's going to be slow.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • I agree with Phil, not pretty and slow.
    Another not pretty and slow idea you might try is to use a for each loop to import the files into 2 tables with a filename field and a datetime stamp. Then build package in ssis that creates the files in the output format you desire and loop around the distinct list of filenames.
    High level thoughts I know but there might be some mileage in it.

    Cheers

    Dave

  • Interesting idea. I like it ! thanks.

    Likes to play Chess

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply