Search code examples
regexgoogle-sheetsgoogle-sheets-formulacurrencygoogle-finance

Convert IMPORTXML data to single currency, export max value via IMPORTRANGE


I'm using IMPORTXML to import prices from a certain website, but they are sometimes in USD and sometimes in GBP. Is there a way for me to import the max value (Converted to EUR) into my main sheet? Here are the sheets in question: (https://docs.google.com/spreadsheets/d/1xUOGusKP7yRuWpBmzdcSC88t8pizdSwi7EqQQC0eQYg/edit#gid=0)

It's easy enough to import prices, but I'm unsure how to use QUERY or any function to convert both currencies to EUR. Please help! Thanks again!


Solution

  • use:

    =INDEX(TEXT(MAX(REGEXEXTRACT(TO_TEXT(IMPORTXML(B1, B2)), "\$(.+)|\£(.+)|\€(.+)")*
     {GOOGLEFINANCE("CURRENCY:USDEUR"), GOOGLEFINANCE("CURRENCY:GBPEUR"), 1}), "#.00 €"))
    

    enter image description here