Home » excel » sql – How can I create an SSIS package which loops through excel files with a specific keyword in their name?

sql – How can I create an SSIS package which loops through excel files with a specific keyword in their name?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am creating an SSIS package which needs to selectively loop through excel files in a folder that contain a specific keyword in their name (the keyword can appear anywhere in the name). This folder will include multiple files that do not include this keyword.

Bonus: I then need to use that same file name to create a date variable in SSIS (the file name will have the required components to create the date inside it). So far my efforts have failed, any help would be appreciated!

How to&Answers:

Create a Foreach File Loop Enumertor. In the FileSpec, use a wildcard, such as:

*SearchString*.csv or *SearchString*.xslx

You will probably want to select the Filename and Extension radio button. Map that to an SSIS package variable.

For the bonus, you can create another package variable with an expression based on the mapped variable and perform whatever string parsing you need in order to extract information from the file name.