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?
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?
Use substitute()
or regexreplace()
with iferror()
, like this:
=arrayformula(
iferror(
iferror(
0.001 *
value(
substitute(
importxml("https://at.fuelo.net/fuel/type/gasoline?lang=en", "//table[@class=('table')]//tr"),
" €/l", ""
)
),
0.001 *
importxml("https://at.fuelo.net/fuel/type/gasoline?lang=en", "//table[@class=('table')]//tr")
),
importxml("https://at.fuelo.net/fuel/type/gasoline?lang=en", "//table[@class=('table')]//tr")
)
)
Or, depending on your locale, it may be:
=arrayformula(
iferror(
iferror(
0,001 *
value(
substitute(
importxml("https://at.fuelo.net/fuel/type/gasoline?lang=en"; "//table[@class=('table')]//tr");
" €/l"; ""
)
);
0,001 *
importxml("https://at.fuelo.net/fuel/type/gasoline?lang=en"; "//table[@class=('table')]//tr")
);
importxml("https://at.fuelo.net/fuel/type/gasoline?lang=en"; "//table[@class=('table')]//tr")
)
)
The 0.001 *
bit and the outer iferror()
are only required when your spreadsheet locale uses period as decimal mark.
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")
=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"))))