Get Visible Text -> Write Data to Datatable

Hello everyone,

I am struggling with an assignment where I need to obtain a list of data from a screen and write this to a data table.


  1. Use get visible text activity to obtain a list of locations
  2. Use the for each activity to write each row of data to a data table


  1. I receive an error message that I cannot convert an IEnumerable Textinfo variable to a data table.

Can someone please help me better understand why I cannot write this data to a data table?

Thank you,


You would have to see the data present in the String variable.
Analyse the recurring pattern and then use generate data Table activity. Or else use regex to identify the data and then insert in different columns.

strClausePlant1 Example:

arrClausePlantList1 Example:

Thanks for the response!


Is there a fixed column width for each column?
And do you need both the columns?

1 Like


The first column will always be two characters, the second column is variable.

Yes, I need both columns.

Can you just give me first 2 rows data, with Name values as variable length.

This is one way I did you can try using Generate DataTable Activity with these parameters.

1 Like

When I try this option the column headers are merged into one row alone with the plant abbreviation and plant name.

That’s why just asking you to copy the data from your variable and write it in a text file.
Edit the data if its confidential, and please share that.

1 Like

Does this data set help you?

Plant Name
AA Detroit Manufacturing Inc.
AE Precision Fastener Of Mexico
AI Aluminum Forge Co.
AK Alaska Metals LTD.

If there is a way to capture only the first column, I can work with this.

This might be easier.

I also need to page down to scrape data from 5 screens.

Will the generate data table activity actually work?

I was trying to use the “add data row activity” so I could include all line items in one data table.



There you go


DTCreation.xaml (13.0 KB)

Testing Data:
Testing.txt (147 Bytes)

Yes you can scrape the data again and again, and then use Merge DataTable Activity.

Hope this helps!

Happy Automation! :smiley:

1 Like

I cant seem to open the xaml file. Could you provide screenshots?

hi @MF.RPA


There you go!

Use your String variable : strClausePlant1 instead of FileData
and instead of DTCreate your DataTable Variable.

Plant = currentItem.Substring(0,2)
Name = new Regex(Plant).Replace(currentItem,“”,1).Trim

Index is used to ignore the 1st row with headers.

1 Like


Thank you for your response.

Your solution has got me going in the right direction.

With the current solution I only add “Plant” and “Name” in the top row of data and I do not add all of the data in the following rows.

Who is writing these assignments? Get Visible Text isn’t how you get data from a page.

Anyway, you have to Split the original string on VbCrLf to get it into individual rows, and loop over that. Then you have to Split each row into the individual column data and then provide that to ArrayRow.

What is the best practice to scrape data from a terminal screen? I found the best results with “get visible text”.

I believe what you are suggesting is what I am doing. I think I might need to increment the index.

Also, I am only pulling the plant now to keep things simple.

If it’s a terminal screen you shouldn’t even be using UI Automation activities, you should be using UiPath.Terminal.Activities and the terminal-specific activities.

Just use…


Put that into For Each and it’ll loop through the rows in the text.

Then in your Add Data Row you’d do something like…

{Split(currentItem," ")(0),Split(currentItem," ")(1), etc}

That assumes each row needs to be split on space (" ") and then the (0) (1) etc gives you the first element, second element, etc from the Split results.

ArrayRow has to be an array, which looks like {“value 1”,“value 2”,value 3"} etc

After comparing your suggestion to my code, it appears that we are doing something very similar. I am using C# which is a slightly different syntax.

The issue is that the application is not looping through the for each.