根据标题名称指定要通过IMPORTHTML/IMPORTXML导入的表 [英] Specify the table to import via IMPORTHTML/IMPORTXML according to its title name
问题描述
表格会更改位置,我需要根据其标题指定要导入的表格,例如,下表标题为 2.5足球预测上/下2.5
站点:
尝试失败:
1-我尝试通过指定表ID来使用 IMPORTXML
,但是导入会导致所有数据集中在一个列中,而不会作为表导入:
= IMPORTXML("https://www.soccerstats247.com/predictions/brazil/serie-a/","//table [@ id ='soccerContentPlaceHolder_gvOverUnderPredictions']//td")
2-我尝试结合使用 IMPORTHML
和 IMPORTXML
来定义标题,但结果完全空白:
= 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)))
预期结果如下:
使用:
= IMPORTXML("https://www.soccerstats247.com/predictions/brazil/serie-a/","//table [@ id ='soccerContentPlaceHolder_gvOverUnderPredictions']/tbody/tr")
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:
use:
=IMPORTXML("https://www.soccerstats247.com/predictions/brazil/serie-a/",
"//table[@id='soccerContentPlaceHolder_gvOverUnderPredictions']/tbody/tr")
这篇关于根据标题名称指定要通过IMPORTHTML/IMPORTXML导入的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!