I have a data table that was created using the data scrapping tool. The second column in the data table is a url. For each row, I am trying to pull the URL from the data table, open the url in a browser, perform a set of activities, then move to the next row / URL.
I have the activities defined, but I am very new to using “For Each Row” activity or working with data tables.
How would I perform this?
Welcome to uipath community
Hope this would help you resolve this
— let’s say your datatable variable obtained from scrapping is named as Extractedtable of type datatable
— now use a for each row activity and pass the above variable as input
— inside the loop use a open browser activity and mention the url property as row(1).ToString
— this will open the url through browser
— now let’s see how the above steps works
For each row loop will usually iterate through row in the datatable one by one
—So for one loop I.e., for one iteration one row will be taken and that is carried by the variable of for each row loop named row
—Now row(“columnname”) will give the value of the mentioned column in the row which is in iteration
Here we can either mention as row(“columnname”) or row(columnindex)
Like either row(“URL”) or row(1)
Where 1 represents the second column index and index usually starts from 0 for the first column
Hope this would help you
Kindly try this and let know for any queries or clarification
Thanks for quick response.
One point to clarify on the open browser step. The url in the table is actually the unique back half of the url based on the corresponding name within the row. So what would be the syntax to add a string in front of the "row(1).ToString.
For example, if the full URL is
“Opening each listed URL from a data table - #2 by Palaniyappan”
My data table has /t/opening-each-listed-url-from-a-data-table/136670/2 in it but not https://forum.uipath.com.
Help with the syntax for this step would be great.
We can just concatenation the strings with a + symbol
To be precise we can take as
Hope This would work for sure
Did that work buddy
Were we able to write the url
I am also facing some similar kind of issue. Your above resolution helped me to resolve the issue partly. My data table has all types of URLs meaning windows explorer’s and web url. I now want to skip windows urls and try selecting only web urls.
How to check the each URL is a web url using If condition. I can only proceed with Opening a browser if it is a web url else I need to skip it and append the spreadsheet with the message in a new column.
Can i have an example if possible
I wont be able to share the exact data but something like this…
From the above, I need to skip the first url/address and only pick the second one. In all there are approx 1250 odd url/address.
So we can use Regex on this isn’t it
Like get this complete string in a string variable named strinput and use this in assign activity
stroutput = System.Text.RegularExpressions.Regex.Match(strinput.ToString,”(?=http).*”).ToString.Trim
Thank you @Palaniyappan.
I will give it a try and let you if it worked.
I have tried it this way but I am still not sure if the ’ Then’ condition would work and browser would open and paste each URL everytime. Can you please validate?
Another issue that I am facing is the browser does open up but the url are not picked up from data table and pasted in the browser for further processing.
You have missed few things
Don’t use IF condition
That stroutput should be in assign activity
—and stroutput should be again passed to open browser
No if condition
oh okay, so you mean to say I need to use two assign activity one for assigning strinput variable and then another assign to pass stroutput following by open broswer
I tried what you suggested, it’s somehow not working for me. The data is available in the data table and the open browser activity opens up new sessions each time however the urls from the data table are not getting selected and pasted in the browser. Pls see below if the approach is correct:
Try it like this, worked fine for me
If not: use a ‘Write Line’
row("ColumnName").ToString inside the ‘For Each Row’ to check the row value.
Thank you @AFWberlin, will try this and let you know
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.