Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lookup country name and return flag image to cell in Google Sheets

I have a country list of 245 countries.

Is there any way I can use a VLOOKUP in Google Sheets to import their respective flags?

I was thinking of potentially using a resource such as Wiki or http://www.theodora.com/flags/ but not sure if I can?

like image 416
user1721451 Avatar asked Aug 02 '17 10:08

user1721451


People also ask

How do I show an image in a cell in Google Sheets?

Select the cell in which you want to insert the image in a cell in Google Sheets. Click the Insert option in the menu. Hover the cursor over the Image option. Click on the 'Image in cell' option.


1 Answers

  • Sample file * Related article

Step 1. Get links

A1 = http://www.sciencekids.co.nz/pictures/flags.html

B1 = //@src[contains(.,'flags96')]

A3 = =IMPORTXML(A1,B1)

Step2. Use image function

B3 = =IMAGE(substitute(A3,"..","http://www.sciencekids.co.nz"))

Bonus. Country name:

C1 = ([^/.]+)\.jpg$

C3 = =REGEXEXTRACT(A3,C1)

enter image description here

like image 174
Max Makhrov Avatar answered Sep 28 '22 06:09

Max Makhrov