'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 1:[1]
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")
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"))))
Solution 2:[2]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 |


