Google Spreadsheet xPath [英] Google Spreadsheet xPath
问题描述
以下是公式I' m试图执行:
= ImportXML(http://finance.yahoo.com/q?s=NGG120616P00040000,// * [@ id =yfs_L10_ngg120616p00040000])
是否有人熟悉importXML的工作原理,在我的情况下,正确的xpath表达式将是什么查询这些数据?
干杯
有两个问题:1)在属性值的情况下很重要,所以你需要一个小写的 l in
yfs_l10_ngg120616p00040000
而不是 yfs_L10_ngg120616p00040000
; 2)@LarsH指出你还需要确保你不在双引号内嵌套双引号。所以,下面是可以工作的表达式:
= ImportXML(http://finance.yahoo.com/q?s = NGG120616P00040000,// * [@ id ='yfs_l10_ngg120616p00040000'])
它产生的值:
0.45
0.45
So I'm trying a test, trying to see if I can import an options price from Yahoo Finance into a google spreadsheet.
Here is the formula I'm trying to execute: =ImportXML("http://finance.yahoo.com/q?s=NGG120616P00040000","//*[@id="yfs_L10_ngg120616p00040000"]")
Is anyone familiar with how importXML works and in my case, what the proper xpath expression would be to query this data?
Cheers
There are two problems: 1) case in the attribute value matters, so you need a lowercase l
in yfs_l10_ngg120616p00040000
instead of yfs_L10_ngg120616p00040000
; 2) as @LarsH points out you also need to make sure you don't nest double-quotes inside of double quotes. So, here's the expression that will work:
=ImportXML("http://finance.yahoo.com/q?s=NGG120616P00040000", "//*[@id='yfs_l10_ngg120616p00040000']")
In this example it yields the values:
0.45
0.45
这篇关于Google Spreadsheet xPath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!