Specify the table to import via IMPORTHTML/IMPORTXML according to its title name

Viewed 172

The tables change position and I need to specify which one to import according to their title, for example, the table below has the title Over/Under 2.5 soccer predictions

Site:
https://www.soccerstats247.com/predictions/brazil/serie-a/

enter image description here

Unsuccessful attempts:

1 - I tried to use IMPORTXML by specifying the table id, but the import results in all the data in one column, it does not import as a table:

=IMPORTXML("https://www.soccerstats247.com/predictions/brazil/serie-a/",
           "//table[@id='soccerContentPlaceHolder_gvOverUnderPredictions']//td")

2 - I tried to use IMPORTHML combined with IMPORTXML to define the title, but the result returns completely blank:

=ARRAYFORMULA(IMPORTHTML(A2,"table", VLOOKUP(A1, {
 TRIM(IMPORTXML(A2,"//h3[@id='1x2']")), ROW(INDIRECT("A1:A"&COUNTA(
 TRIM(IMPORTXML(A2,"//h3[@id='1x2']")))))}, 2, 0)))

enter image description here

The expected result would be like this:
enter image description here

1 Answers

use:

=IMPORTXML("https://www.soccerstats247.com/predictions/brazil/serie-a/",
           "//table[@id='soccerContentPlaceHolder_gvOverUnderPredictions']/tbody/tr")

enter image description here

Related