首页 > 解决方案 > 如何使用 IMPORTXML 导入图像

问题描述

从网站导入:https ://weather.interia.com/long-term-forecast-chicago,cId,49700

我正在尝试在以下类中导入图像 URL 列表:

在此处输入图像描述

单元格中的 URLA1

我试过使用

=IMPORTXML($A$1, "//img/@src")

虽然这确实会导入一些图像,但它不会导入所需的图像。

标签: imageweb-scrapinggoogle-sheetsgoogle-sheets-formulaarray-formulas

解决方案


你能做的最好的就是:

=ARRAYFORMULA(IMAGE("https://weather.interia.com/i/icons-bg-light-2/"&ROW(A1:A60)&".png",3))

0


更新:

=ARRAYFORMULA(IMAGE("https://weather.interia.com/i/icons-bg-light-2/"&
 IFNA(VLOOKUP(IMPORTXML(
 "https://weather.interia.com/long-term-forecast-chicago,cId,49700", 
 "//span[@class='weather-forecast-longterm-list-entry-forecast-phrase']"), { 
 "Showers"            , 12;
 "Partly sunny"       , 3;
 "Cold"               , 31;
 "Mostly cloudy"      , 6;
 "Dreary"             , 8;
 "Cloudy"             , 7;
 "Mostly cloudy"      , 8;
 "Mostly sunny"       , 2;
 "Intermittent clouds", 4;
 "Freezing rain"      , 26;
 "Flurries"           , 19;
 "Sunny"              , 1;
 "Hazy sunshine"      , 5;
 "Snow"               , 22}, 2, 0))&".png", 3))

0


推荐阅读