Data Scraping Horizontal Table

I have a horizontal table on a website that has the html structure something like this:

Header1 Value1 Value2
Header1 Value1 Value2

There are about 30+ rows in the table. When I use the data scraping method it will only pull back two columns, but the header is also needed to ‘act’ like a column for purposes of the automation I’m trying to complete.

So get me Value1 and Value2 for Header1 for example

So on the website it looks like:
image

The Data Definition from the scrape is like this.

I can only get 2 columns, those columns seem to change if I tweak the get_columns_name number…but even so the headers are all squeezed into the header of datatable.

I’ve managed to do 3 separate datatables to get me the data but now also facing an issue of merging all the tables:

Data Definition to get individual column:




tag and class just updated for other columns.

So I guess my question is:
1 - Is there away to get the scrape to work so I have all three columns
2 - If not how can I merge the 3 tables. Each table having different columns

I’ve looked at various articles on merging tables and data scraping and they have only got me to this point

Can’t edit but there is a section not showing. Should be:

Data Definition to get individual column

<extract>
	<column name='Name' attr='text'>
		<webctrl tag='th' class='Header'/>
	</column>
</extract>

To get the other columns just update tag and class

2 Likes

@scott.newbould When you try to do Data Scraping and after you indicate the First Cell Doesn’t it prompt whether you want to Extract the Whole Table Question?

1 Like

Yes it does. The above mentioned is when I scrape all table…Just noticed it is missing the data definition from the whole table scrape. Looks like this:

<extract-table get_columns_name="1" get_empty_columns="1" columns_name_source="Longest" />

Think I have come up with a solution that works. Here goes:

So using the method to get 3 data tables:




*update tag and class where needed to each of the columns

I now have this:
headerDataTable
value1DataTable
value2DataTable

Next part is to add the additional columns to the first datable using an ‘Add Data Column’ activity to create columns ‘Value1’ and ‘Value2’ in Data Table headerDataTable

Now to loop through headerDataTable and add each row value from value1DataTable and value2DataTable

as so (headerDataTable is pNameDb in my working example):
image

Assign activities in detail:

row(“Value1”) = pValue1Db.Rows(rowIndex).Item(“Value1”).ToString
row(“Value2”) = pValue1Db.Rows(rowIndex).Item(“Value2”).ToString

2 Likes

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