如何使用IMPORTXML导入货币数据?

时间:2019-05-20 14:05:46

标签: regex google-sheets google-sheets-formula google-sheets-query google-sheets-importxml

我正在尝试将ImportXML与XPath代码一起使用以获取货币汇率,但是此代码无法正常工作。

=IMPORTXML("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"; "/gesmes:Envelope/Cube/Cube/Cube[@currency='USD']@rate")

1 个答案:

答案 0 :(得分:2)

=REGEXEXTRACT(QUERY(
 IMPORTDATA("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"); 
 "where Col1 contains 'USD'"; 0); "rate='(.*)'")

0

0