How to use for each row to take cells content of entire column 1

Hello everyone,
This is my second post and I am really happy to be part of this community, I am enjoying a lot the learning of UI path. I do need some expert 's help now though.
On the csv attached, there is a list of referral numbers from row 1 to 60 all in column 1.
I would like to use the for each row activity( or any other better method),to take the content of all cells of column 1, one by one ( first one being A1 then A2 until A60), find that content on a website and when found on the website click on it.There will operation in between clicks that is working for me currently. I would like to iterates the clicks and the operation that each clicks has.
Here are both files, let me know if you have any questions.
Thank you in advance.
testforeachrow.xaml (2.1 KB)

Edit: I cannot attach the csv file unfortunately but this is what the content looks like for that column, a number followed by a letter.

Hello @boyses,

Use the Get Row Item activity inside the For Each Loop take the value form ‘Get Row Item’ by setting it’s properties to Column index as ‘1’. It will give you the Cell value of your whole column. Take that value and do what you want.

Ask me if any doubts.

Michael Udhaya

1 Like

@boyses if you want to iterate each row from A1 to A60 I would recommend you to use for each row where you can iterate each row and inside the body you can use that whatever you want.


Hello @boyses just for sake of trying different method, you can try below…

List of String ListWords = (From x in dt.Rows select colx = x(“ColumnName”).ToString).ToList

For each str in ListWords
Click activity here (click where UiElement value = str)
rest of activities here…


Hello @Michael_Udhaya,
Thank you very much for answering, I will be trying your method and let you know how it works.
Also what would I need to put in the row input? Do I need to create a string variable for the entire column and put as row?
Just for learning purposes, how would you make the tablerow selector dynamic?
Thank you again,

Hello @venkatmalla6
Thank you for answering, I have been trying to use this loop for this project for a while now and it either does not loop or just the take A1 or just take A60. I want to make sure AI understand fully this concept and if there is another method to get a way around it.
Thank you,

Hello @AkshaySandhu,
Thank you very much for answering,just to make sure I understand your answer, you would create a list variable and a string variable to store all info of the first column and use assign activity with List of String ListWords = (From x in dt.Rows select colx = x(“ColumnName”).ToString).ToList ?
Then create the for each str in listword, then click on the first value of the str? what is the next used for?
Thank you

Hi @boyses, here you go!

Put this sequence.

  1. For Each Row (that Datatable)
  2. Get Row Item (strRowValue)
  3. Your Sequence (that web interaction)
  4. Click Text value as strRowValue
    Or use Selector aaname=strRowValue
  5. Navigate to common page.
  6. It will click that founded text until all row values

Use Element Exist to find the file is on the web page. If found then proceed, else iterate next loop.
Put the ‘Click Text’ into the Try Catch block so you can skip the process.

Michael Udhaya

1 Like

Thank you very much for your answer again @Michael_Udhaya.
However I do get the error that strrowvalue of value string cannot be converted to
When I fix the variable it tells me it cannot converted system row to string… what did I do wrong?
Thank you

@boyses, i the strRowValue variable variable for Get Row Item activity output. Not a row item.

1 Like

@Michael_Udhaya oh my bad, then can you explain to me the row item because now i’m just confused what it is please, what would I need to put on there as it is the only error I have left I think.
Thank you,

Go through below link.

This video make you clear.

1 Like

@Michael_Udhaya I am sorry but I do not understand what is the data row object is and it the get row activity is not being used in the video, do you have an example for what you would put on there so I understand please? is it a variable, if yes what type?
Thank you,


Do what i posted. You can understand.

You have your Datatable variable (dtExcelData).
Put for each row activity. It will came with default variable row nearly Foreach label. It was the dataRow type. Buy we don’t want it now. Next ‘in’ label put your Datatable variable dtExcelData

In the ‘body’ sequence put the Get row item activity. In the text box type row(it was thedataRow).
If your Datatable have headers then you can pass the value in ‘Column Name’ Property. Else pass the index of your column (in your case only one column so you simply type 1) in ‘Column Index’.

In the Output property section put that variable name ‘strRowValue’ (as Generic Value) in ‘Value’ box.

Also look into this video(watch be careful after 11 minutes. It was your question).

Michael Udhaya

1 Like

Hi @boyses

I have created workflow based on your requirement open run and check it will help you.
Please find below screenshot

image (19.3 KB)

1 Like

Oh okay I was overthinking it way too hard… Thank you very much for your help @Michael_Udhaya I really appreciate it. I do get this error though when I have the whole for each row completed… image

what will be the fix here?
Thank you,

Thank you very much for answering @kommijeevan
that is the workflow I have running now, theonly difference is I have csv fille… do I need the read range activity and convert my file first to not get any errors? be low is what I have

Thank you

@boyses, I’m sorry, it was my mistake only.:point_down:

This error usefully occurred when your data has Blank. In your screen shot, You mentioned in the Column Index as 1. If you have only one column in your Datatable, then the index should be 0.

Column Indexes started from 0

Let me know if it is work.

Michael Udhaya

1 Like

@Michael_Udhaya Oh I should have spotted that too… But after correcting that number I get the same error, any other possible cause of that errors?
Thank you

@boyses, can you show me the screenshot?