问题
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/
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)))
The expected result would be like this:
回答1:
use:
=IMPORTXML("https://www.soccerstats247.com/predictions/brazil/serie-a/",
"//table[@id='soccerContentPlaceHolder_gvOverUnderPredictions']/tbody/tr")
来源:https://stackoverflow.com/questions/65451069/specify-the-table-to-import-via-importhtml-importxml-according-to-its-title-name