如何使用IMPORTXML导入图像

时间:2019-12-09 21:12:40

标签: image web-scraping google-sheets google-sheets-formula array-formulas

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

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

enter image description here

单元格A1中的URL

我尝试使用

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

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

1 个答案:

答案 0 :(得分:1)

您能做的最好的是:

=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