如何获得没有符号的价格 €/l?

How to get price without a sign €/l?

我使用这个公式来获取数据:

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

如何获取没有符号的价格€/l?

substitute()regexreplace()iferror() 一起使用,如下所示:

=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") 
  ) 
)

或者,根据您的语言环境,它可能是:

=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") 
  ) 
)

仅当您的电子表格语言环境使用句点作为小数点时才需要 0.001 * 位和外部 iferror()

使用:

=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"))))