根据标题名称指定要通过IMPORTHTML/IMPORTXML导入的表 [英] Specify the table to import via IMPORTHTML/IMPORTXML according to its title name

查看:56
本文介绍了根据标题名称指定要通过IMPORTHTML/IMPORTXML导入的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表格会更改位置,我需要根据其标题指定要导入的表格,例如,下表标题为 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆