The Files:
entry on the Collection
tab of the Foreach Loop
container will accept wildcard characters.
The general pattern here is to create a variable, say, FileName
. Set your Files:
to something like:
Files:
BaseFileName*
or, if you want to be sure to only pick up spreadsheets, maybe:
Files:
BaseFileName*.xlsx
Select either Name and extension
or Fully qualified
, which will include the full file path. I usually just use Name and extension
and put the file path into another variable so when Ops tells me they're moving my drop location, I can change a parameter instead of editing the package. This step tells the container to remember the name of the file it just found so you can use it later for a variable mapping.
On the Variable Mappings
tab, select your variable name and assign it to Index
0.
Then, for each spreadsheet, the container will loop, pick up the name of the first file it finds that matches your pattern, and assign the full name, with the date extension (and path, if you go that way), to your variable. Pass the variable as in input parameter to the tasks inside the loop and use that to process the file, including moving it to the archive, or you'll get yourself into an infinite loop, processing the same file(s) over and over. <--Does that sound like the voice of experience? Yeah. Been there, done that.
Edit:
Here, the FullFilePath
variable is just the folder name, without a file reference. (Red variable to red entry in the Folder
box).
The FileBaseName
variable drives what shows up in the Files
box. (Blue to blue).
Another variable picks up the actual file name, with the date extension. Later, say in a File System Task
, if I need the folder & file name together, I concatenate the variables.

As far as the Excel Connection Manager
error you're getting, unfortunately I'm no help. I don't use it. We have SentryOne's Task Factory for SSIS which includes a much more resilient Excel connector.