Google Spreadsheet xPath [英] Google Spreadsheet xPath

查看:106
本文介绍了Google Spreadsheet xPath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在尝试一个测试,试图看看我是否可以将雅虎财经的期权价格导入到Google电子表格中。



以下是公式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屋!

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