Help with nested For Each Loop

Hey ,

I have an excel file with ID in one column and url of excel files in another. The ID is used for search on the web and download data, and this downloaded data needs to copied to the url linking to the Id in the excel sheet.
How do i call the url after searching and downloading the data ?
Can i do a nested for each loop ?

Hey!

Yes you have to use 2 - For each row in data table to loop through the each row.

Then use the currentRow(“ColumnName”).ToString to loop through the ids

Regards,
NaNi

So i know how to loop through the Id. But once i loop through the Id how do i call the url linked to it ?

@diya_poovamma
please follow these steps,
1-merge both excel sheets and get one datatable.
2- loop over datatable accordingly
In merging you will work with single loop.

Hey,
Both the columns are in the same sheet. But i don’t understand how i can call the url after downloading data using the ID .

@diya_poovamma can you show excel please for just demonstration.

Hey!

Could you please explain the process a bit more…

What do you mean by linking the data to that id?

If it is a url use Open browser to get it in to that URL

In UiPath we can get the values not the Format (Bold,Itelic or hyperlink)

It could be better to explain a bit more…

Regards,
NaNi

So every Id has a different file and i need to copy data that is downloaded into the url next to the Id

Hey,
Sorry . But by url i meant excel file path. So the each id has a seperate excel file and these file paths are mentioned in the column next to the Id.

I loop through each id and download the data, then this downloaded data needs to be copied to the excel file path mentioned .

Hope this is clear

IdandURL_DataTable.xaml (6.4 KB)

@diya_poovamma Here is demmy code, please follow these steps

Thank you. Will try this and let you know if it works .

Hey!

Got it…

Once you use the for each row in data table

Take one assign activitie

assign strID = CurrentRow("ID").ToString.Trim

Take one more assign activity

assign strURL = CurrentRow("URL").ToString.Trim

Before downloading use wait for download activity And make sure you enabled the ask for download option in the chrome. Once we hit on the download option the file explorer will pops up…

Use the attach window activity to stay intact with the explorer in the file name field provide the

 strURL 

Thats it

Try this and ley me know

Regards,
NaNi

Hi,
Thank you. But i didnt understand after the download part .
Could you please elaborate ?

Hi,
I looked into the flow. For Id i need to use an Assign activity and put the value in it ?

And if i use url later the data will not get copied to the same url right ?
It will itarate and go to the next url for every id ?

Hi,
I tried using this but after downloading the data its getting copied to the same Url and not to the next Url as in the excel sheet .

Do you have any solution for this ?

Hi @diya_poovamma
Still I am not getting your point? where you are getting same url

So, like shown in the excel file there is a different file path for each id.

Once I use the Id to download all the data , i use a for each loop for all the downloaded data for that Id to be copied to the respective file path.

But what is happening is each time the downloaded data is getting copied to the same Url. I guess its because of the for for each loop.

But i dont know how to solve it to copy to the respective url each time the data is downloaded.

Hope this is clear.

@diya_poovamma Can you share code.