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