Search code examples
google-sheetsimportgoogle-sheets-formulaspreadsheetgoogle-finance

How to get price without a sign €/l?


I use this formula to get the data:

importXML("https://at.fuelo.net/fuel/type/gasoline?lang=en"; "//table[@class=('table')]//tr")

How to get price without a sign €/l?


Solution

  • use:

    =QUERY({IMPORTXML("https://at.fuelo.net/fuel/type/gasoline?lang=en"; 
     "//table[@class=('table')]//tr")\ INDEX(SUBSTITUTE(IMPORTXML(
     "https://at.fuelo.net/fuel/type/gasoline?lang=en"; 
     "//table[@class=('table')]//tr"); " €/l"; "");;2)}; 
     "select Col1,Col4,Col3")
    

    enter image description here


    update:

    =ARRAYFORMULA(IFNA(TEXT(REGEXEXTRACT(SUBSTITUTE(
     IMPORTXML("https://at.fuelo.net/fuel/type/gasoline?lang=en"; 
     "//table[@class=('table')]//tr"); "."; ","); 
     "\d+,\d+")*GOOGLEFINANCE("currency:EURUSD"); "0.00"); TRIM(
     IMPORTXML("https://at.fuelo.net/fuel/type/gasoline?lang=en"; 
     "//table[@class=('table')]//tr"))))
    

    enter image description here