how to read dynamically changing source excel files

  • Hi All SSIS Gurus

    i need help. i have a ssis package which loop through the excel files and import the data into sql table. it is working fine with reading multiple files in a folder. issue is file names has date time stamp means file name changes everyday and i couldn't figure out how to accomodate new file names into my package. read few articles and they talk about using script task. could anyone please give me details instruction about the script because i have no idea from where i should start writing the script. please help...

    Thanks

  • You don't need a script. You can specify a wildcard in your For Each Loop container.

    For example:

    myExcelFile*.xls, where * takes place of the timestamp.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • this is what i am doing and it works fine for multiple files. but when i have to execute the package next time my file name changed (new date time + some random numbers). problem is in variable we specify the first file name imported and that file name is changed now. how i can deal with that? i hope i make some sense.

  • This is what I do:

    put a for each loop with a file enumerator on the source folder and specify a wildcard in the filename.

    Specify that the full path should be retrieved and I put this in a variable.

    On the Excel connection manager, I specify an expression using this variable.

    Set DelayValidation = TRUE on the dataflow.

    Normally that's all you need to do.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • i specified 2 varibales at package level and used then in for each loop and excel source connection

    SourceFileName-- specifies file name can't use wild card doesn't work

    SourceFilePath--specifies folder address

    how to reterive the full path (including file name) into a varibale? we need to go through the files in the folder how we can do it without script?

    please elaborate if u can

  • Looping over files with the Foreach Loop

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • as i mentioned earlier this is what i am doing and it works fine as long as file name doesn't change. my problem is file name changes every day.

  • How does such a filename look like?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • thanks for your time. after struggling for a day and half i figured out what needs to be there in script so that it can pick all the file names and pass it on to dataflow.

  • HI ,

    Can I get the script also.

    Thanks,

Viewing 10 posts - 1 through 9 (of 9 total)

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