Search code examples
regexgoogle-sheetsgoogle-sheets-querygoogle-sheets-formula

How to import money data using IMPORTXML?


I'm trying using ImportXML with XPath code to get currency rate, but this code not working.

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

Solution

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

    0

    0