loop row by row from an excel file map to variable

448 Views Asked by At

I have 4 columns in an excel file. I need to assign values from each row to the corresponding 4 variables so they can be replaced lated in a query i am doing on a server. My question is: How to do that? So far i tried doing an SQL task in which i create a table with 4 columns (having the same names as those in my excel file) and a task to transfer the content of the excel to a recordset destination which stores the results into a variable. I also created a foreach loop in which i am having my tasks. What am I missing, how can I do this? Thanks

EDIT

please find below a screenshot from my project. This is the overview.

overview

In "Execute SQL Task" there is a connection to excel and has the following statement

CREATE TABLE tempVariableMapping
(
AsofDate varchar(20),
Assump_Set  varchar(20),
MarketName  varchar(20),
Portname  varchar(20)

);

Then in the transfer task (in the recordset destination), i'm assigning the variable name to User::RecordSetOutput which is a global variable of type object.

In foreach loop i'm using a foreach ado enumerator and pointing to that User::RecordSetOutput variable find below the variable mapping enter image description here

Those 4 variables in variable mapping are those in which i want to pass the values from each row of the excel file.

The sequence container and create temp table are just dummy. Haven't figured out the correct way. Everything below that, works. Sorry for the missunderstanding, hope this is enough to get the picture. Thank you for your time and help

0

There are 0 best solutions below