Issues about function "get table data"

Hi Team,

Greetings!

When I used the tool “get table data”, I encountered some typical problems were as following:
(1)Parameter “headerrowxpath” cannot be identified properly, I tried the xpath like “//div[@id=‘app’]/div/div[4]/section/div/div/div[2]/div[2]/table/thead/tr/th[2]/div” or “//div[@id=‘app’]/div/div[4]/section/div/div/div[2]/div[2]/table/thead/tr/th[2]/div/text()” , both of them didn’t work. The header of result set is always “cellx” as showed in image.


(2)Parameter “xPath” cannot be identified properly, I thought this parameter means the area of data range in html. When xPath was set to the type like “//div[@id=‘app’]/div/div[4]/section/div/div/div[2]/div[3]/table”, it worked properly. But I when changed it to more accurate type like “//div[@id=‘app’]/div/div[4]/section/div/div/div[2]/div[3]/table/tbody/tr[1]/td[2]/div”, it was failed to catch the data in html.
(3)The fetched results of get table data always automatically put the numeric columns at the front of the result set.


Thanks for your great help !

Hey,
Just to “set the expectations” of using GetTable.
The GetTable activity was made by me to test if there was a need for a more “autonomous” way of grabbing table data from a webpage. It was a “test” to get feedback from people to see if I should continue working on it, but also to see if there was actually a need for something like this (for instance, UiPath has a very nice Wizard for extracting table data). For a long time, no one really used it, so I kind of forgot about it. It’s still a little rough around the edges, but for simple HTML tables or Bootstrap-like div tables, it should still work very well (like on the Wikipedia page).

Ok, now to answer your questions:

  1. By default, GetTable will try and “guess” the datatype for each column and use that in the result datatable. Sometimes, if you have mixed data or regional settings do not match the website, you don’t want that. So setting SkipTypeCheck to true can help if you get weird errors like Error converting value "[n 2]2023" to type 'System.Int64'. Path '[39].cell7', line 263, position 24. or if the resulting datatable has wrong data.
  2. The naming of the properties is not super user-friendly, I know. Let me try and clarify:

Xpath: should point to the main HTML element that contains the table; you cannot point it at something inside the table. The activity uses this element to try and detect what type of table it’s working with and then starts enumerating on the values. If you give it an element inside the table, this will fail.
rowspath: If the table has some “extra” elements inside it before it lists each row (for example, if there are 2 extra divs before it starts “listing out” each row), you can make the script add this in front of the xpath it uses to grab the list of elements inside the table.
cellspath: If each row has some kind of wrapper elements (most likely one or more divs), you can make the script add this xpath in front of the query to grab each cell in the row.
cellpath: If the data is not directly inside each cell located (for example, if you added spans or divs around the data), you can define an xpath added to the selector before grabbing the individual data in each cell.

Again, GetTable was meant to be used for simple table structures. If you need more advanced logic (for example, if each cell has a different layout of how to “get to the data value”), you will need to build it the “old way” by nesting 2 or more Get Elements inside each other and looping over the data.

Allan, thank you for a lot of patience. I’m interested in this function. If there were new features of this function, I will to try it at first time. Thanks for your great help !

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.