【问题标题】:Google sheets importhtml xpath谷歌表 importhtml xpath
【发布时间】:2018-09-16 18:53:05
【问题描述】:

我想从this page 中删除数据,但是,我无法为=importxml 函数获取正确的xpath。

我想获得跨度类namerate。 例如

column A, column B
Robert Mistrík, 2.5

你知道我应该创建什么 xpath 吗?

【问题讨论】:

    标签: xml google-sheets


    【解决方案1】:

    这就是你获得名字的方式

    //span[@class='name']
    

    这就是您可以提取特定字体评级的方法

    //span[@class='name'][contains(.,'Róbert Mistrík')]/following-sibling::span[@class='rate']
    

    如果您需要提取所有字体及其对应的值,那么您需要首先使用//span[@class='name'] 找到字体名称,您将获得字体名称,例如Róbert Mistrík 那么你必须在 //span[@class='name'][contains(.,'Róbert Mistrík')]/following-sibling::span[@class='rate'] xpath 的 contains 方法中传递相同的内容。

    【讨论】:

    • 嗨,非常感谢您的时间和回答。这就是我认为它应该工作的方式,但实际上并非如此。 :-(。如果你尝试=IMPORTXML("https://m.tipsport.sk/prematch/match/2921022/events","//span[@class='name']"),它只会返回#N/A。
    • 那么这个=IMPORTXML("https://m.tipsport.sk/prematch/match/2921022/events","//span[@class='name']/text()")
    • 相同。它返回 #N/A :-(
    猜你喜欢
    • 1970-01-01
    • 2023-01-01
    • 2018-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多