How to iterate through columns

excel
loop
uiautomation
studio

#1

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

Untitled

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.

Project13.zip (623.7 KB)


#2

@Serran_Neru

Have a look into this post


#3

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?


#4

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.


#5

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.)


#6

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?


#7

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


#8

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

Regards…!!
Aksh


#9

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.


#10

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


#11

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.