0

I have two Excel files named 'First' and 'Second' in same location . enter image description here

They have same schema.

enter image description here

I used foreach loop counter and put Data flow task into it.

enter image description here

The data flow diagram looks like this:-

enter image description here

Here, I selected first excel file as the source....

My For Each Loop Container Editor:-

enter image description here

After running the SSIS package successfully the output came like this:-

enter image description here

Which took data only from First excel file and three times,I must have done something wrong in there,But I cant figure it out.

BlackCat
  • 1,932
  • 3
  • 19
  • 47
  • 3
    Possible duplicate of [How to loop through Excel files and load them into a database using SSIS package?](http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package) – iamdave Sep 01 '16 at 09:18
  • Please show a screenshot of your Excel Source properties. – Tab Alleman Sep 01 '16 at 12:53
  • 1
    @zahid See this Answer. => http://stackoverflow.com/a/7412643/325521 It walks you through doing this step-by-step with screenshots. I think you are missing the `FilePath` variable in your `For Each` Enumerator and in the `Excel Connection Manager`. – Shiva Sep 02 '16 at 02:26

1 Answers1

0

Check your Foreach Loop Editor:

Collection>Folder
Collection>Files

Your file should not have a particular file name, for multiple excel use *.xlsx.

Edit:

Use a Script task to Debug. Map the value of ForEach to a variable and display it through Script task. Edit the script task with below code.

MessageBox.Show(Dts.Variables["Variable"].Value.ToString());

Also, Please check your Source Excel connetion is configured correctly with values coming from foreach.

p2k
  • 2,126
  • 4
  • 23
  • 39