Lesson 12 practice 1 - for each "row" in "valuesTable" - row variable not recognized within the loop



I do not have Microsoft Excel, so I don’t think I can use the excel specific activities within UiPath (not 100% sure about that). Instead I’m using the generic workbook activities.

Here’s my for each loop:

And here’s the error I’m receiving:

EDIT: I changed the display name of the Assign activity in the Finally block of the Try Catch segment to verify it’s the source of the error. The first screen shot doesn’t reflect that though sorry


I believe you can use Workbook activities and it should work fine even if you dont have excel activities installed.

Can you explain a bit what you are trying to achieve? Are you trying to add your result.ToString value as a new row for the valuesTable DataTable. If yes, you may want to try ‘Add Data Row’ activity for it.

Also, just to check if your DataTable valuesTable actually contains any value or now, add a message box above the for each loop with valuesTable.Row.Count.ToString. This should give you the number of row within the DataTable and help you identify where the issue actually occurs.

Let me know if it helps.

Rammohan B.


Yeah, I’m trying to do it with the generic workbook activities. I’m trying to add information to the existing rows.
It seems that yes, valuesTable is being stored properly

It should find the difference in the values of Cash In and Cash Out and print the result to the Difference column. Some of them of course will have problems because they contain letters. So the result printed will say there’s a problem.



Try using the following syntax in your Assign activity

row.item(“Difference”) = result.ToString


row.item(2) = result.ToString