Google 个工作表中的 ImportXML XPath URL

ImportXML XPath URL in Google Sheets

我刚开始使用 google sheets,我想知道是否可以使用 importxml XPath

获取 link

https://prnt.sc/orrxpv

在此屏幕截图中,您可以在每周更改的主锦标赛子菜单下看到可点击的 link。目前,我每周都会手动复制粘贴它,您可以在下面 sheet linked

的 a16 单元格中找到它

https://prnt.sc/orrx4y

这是我正在尝试获取 XPath 的 XPath(我在这方面完全是菜鸟)并试图将其构建到 a14 单元格中的公式中,但失败得很惨。

我还想知道是否可以在 link 之间 =concatenate 一些东西 例如:

https://www.tennisexplorer.com/cincinnati/2019/atp-men/
https://www.tennisexplorer.com/cincinnati/2018/atp-men/
https://www.tennisexplorer.com/cincinnati/2017/atp-men/

我想更改 link 之间的年份,但不知道如何:(

Link 到具有编辑权限的 sheet :) https://docs.google.com/spreadsheets/d/16Y6q2tw26c-nbmqIrXiQ_ZhuDc48oAzkXvOl78kVy00/edit?usp=sharing

要在 link 中创建可选年份,请使用:

="https://www.tennisexplorer.com/cincinnati/"&B1&"/atp-men/"


要获得 Cincinety,您可以这样做:

=ARRAYFORMULA(QUERY(TO_TEXT(IMPORTXML(
 "https://www.tennisexplorer.com/cincinnati/2019/atp-men/", 
 "//td[@class='t-name']")), "select Col2 where Col1 is null limit 1", 0))

然后整个公式将是:

="https://www.tennisexplorer.com/"&
 ARRAYFORMULA(QUERY(TO_TEXT(IMPORTXML(
 "https://www.tennisexplorer.com/live/", 
 "//td[@class='t-name']")), "select Col2 where Col1 is null limit 1", 0))&"/"&B1&"/atp-men/"