Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set up a dynamic file path in SSIS for an Excel file?

Tags:

sql

ssis

The name of the file changes based on months. Every month you have a new file.

I:\Test\Data_201303.xlsx

How do I set up a connection manager that will work with variable file paths?

like image 375
JJ. Avatar asked Mar 05 '13 18:03

JJ.


People also ask

How do I create a dynamic Excel connection manager in SSIS?

Step 1: Create a package and create a new connection (in the connection panel, right click and choose Excel connection) with an Excel connection and connect to the sample1 excel file given above. Step 2: Declare a variable “ExcelFileName” as string and Assign static value to the package variable.


1 Answers

Look for the "expression" property on the connection manager. That's where you set it to USER::VariableName.

More detail: if you "edit" the connection manager it will show you the edit window. That's not the one you want. Look at the "properties" window, which is where you will find the "Expressions" entry, in front of an empty box.

Click on the empty box, and it will show you a button with three dots on it. Click on that button. This pulls up the "Property Expression Editor". There is a dropdown with properties like "ConnectionString" on the left. On the right, there is ANOTHER button with three dots. Click on that button to pull up the "Expression Builder". If you have declared any variables, you will find them listed in the upper left hand corner, e.g., as User::VariableName, and you can then drag them into the Expression box, where they will appear as @[User::VariableName].

Not obvious, but doable.

like image 78
criticalfix Avatar answered Sep 23 '22 15:09

criticalfix