How to add dynamic Get Text value captured from website and add it to data table in a new column?


#1

Hi All,
I am new to UiPath and I have following workflow to be done as :

I have scrapped the websites URLs and For each URL from scrapped data table, I need to get the text present on the each website. Now I already have URL column through scraping. I am creating new column using “Add Data Column” and trying to add the Get Text value from each website to that column. So at the end I have to write the whole data table including 2 columns as URL and Text in an excel.

Currently while I am adding the text value to data table row as in the format :-
“dataTable.row(i).item(“Text”)= TextValue” , I am getting an error as “Assign : Exception has been thrown by the target of an invocation.”
I have used ForEach loop sequence. The similar exception error is there when I use For Each Row sequence. Can anyone please suggest the solution to achieve the workflow aim?
Help is highly appreciated. :slight_smile:

Regards,
Komal


#2

Hi Komal,

Have you tried writing the contents of the data table to an excel before adding values to it. Just make sure the datatable has the right columns and values.

Second, to loop thru data table use a For Each Row activity, and inside the loop you can assign the values:

row(“Text”) = TextValue

Hope this helps you.


#3

Hi @PD2 Thank you for the reply.
I added the new data column to data table and added integer value ‘i’ through loop For Each Row as " row(“Text”) = i " just to see whether the contents are getting assigned to each row and getting written in excel correctly or not. To my knowledge the contents are getting correctly on excel with added data column.
But when I assign string value to row(“Text”) = TextValue (captured using Get Text), the exception error is getting displayed. Looks like it’s not able to handle the string value when it comes to assign to row value in a loop. Can you suggest a solution on this?

Regards,
Komal


#4

Well I wasn’t aware that you were using assigning value from get text activity. The result of Get Text activity is usually a Generic value, please try to convert it to a string using TextValue.ToString() method and you should be fine.

Let me know how it goes.


#5

hi,
please follow tutorial to ass column to the existing data table.

thanks,
karthik.