How to iterate through columns



I’m trying to iterate through columns (column A, B, C, D…) - to copy unfixed range of data and paste into a web.


Now I’m stuck to iterate through columns and specify the range in “select range” activity.

I’ve attached my workflow for your further reference.

Kindly provide some insight on how should go with this. (623.7 KB)



Have a look into this post


Hi Ranjith, I saw this post earlier, but I still unable to figure out what should I mentioned in the range in “select range” activity. Any idea on this?


I guess you were saying about the Select Range property in Read Range Activity. If you need to grab the entire sheets data into datatable variable then leave select range property as blank. And also check the Add Header property if your sheet has headers.


No, I dont have to grab the whole sheets data. I need to copy one by one (meaning all data from column A, column B and so on.)


I think maybe you could read the file as a datatable and then use a for each activity to loop through each column (item) and assign the values to another variable as say, an array of int, which you can then use for pasting elsewhere?


Hi Djh, could you please show me an example. I still cant figure out.


you can use String.join like this

String ColA_Data = String.Join(Environment.NewLine,dt.AsEnumerable().[Select](Function(x) x.Field(Of String)(<Datatable_Col_name>)).ToArray())

Use Set to Clipboard Activity to set it on clipboard and use Get From Clipboard Activity to paste it



Get Column Data.xaml (13.3 KB)
Test Excel.xlsx (13.9 KB)

This is a simple way of reading the data form a single column int he attached excel file, you will see at the end it is just added to a string and then logged. I have repeated for column 2 but you can repeat for all columns.


Hi i have a string $10-50 . i want 50 how can i get testString.Substring(testString.LastIndexOf("")+1,testString.Length-1)

error is coming


Hi @Djh

I have gone through your sample workflow but I am not getting correct solution to my problem. can you please look into it.

I am new to UiPath and I am trying to test facebook using excel sheet. I am able to loop the workflow using for each row activity successfully. For the first time the application is taking input value correctly. But, second time the application is taking empty spaces and unable to login facebook. Please find attached excel sheet and workflow.

FacebookTest.xaml (21.9 KB)
TestData.xlsx (9.8 KB)

Can anyone tell me how can I loop only the search field for the second time.


I have one excel data. and convert it to Datatable. i need to iterate one particular column from that datatable.???