For Each looping twice


I am trying to output some data into an excel. When I run the workflow it reads a word doc, I regex the parts I need. I assign the enumerable/s to a variable. I create a datatable and have column headers. All good up to here. I can see the debugging providing the correct variables where needed.
I then run the For Each
ForEach ‘item’ in ‘Variable’
Add Data Row, ArrayRow: {Variable(0),Variable(1)}
Datatable: datatable name

when I step into, it does ForEach it writes the correct data, then I step into again and it writes the output again.
Viewing an excel and output data table, show to double entry

UiPath output

The issue definaltey is in the ForEach, have I not used this function correctly?

Excel output

ForEach Settings

AddDataRow Settings

You are looping through wordOutput which has two items, so you will loop twice. Each time you add the same row {wordOutput(0), wordOutput(1)}. This is why you have the same row twice. Why to you loop through wordOutput at all?


For Each looping correctly, as you have 2 values in array of wordOuput

Can you share what was the problem in that

Hope this helps you


wordoutput is an array that has increasing values applied to it as I progress via the workflow
so I have acID and DOB variables that i add as the workflow continues

Apologies I could have set that up wrong., I want to add values to into an array so i can put them into a datatable at the end