Warwick Logan
Warwick Logan

Reputation: 117

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

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!

Upvotes: 1

Views: 162

Answers (1)

J Weezy
J Weezy

Reputation: 3945

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.

Upvotes: 2

Related Questions