The images must be available online and reachable with the “https://” protocol.

Download the worksheet (link at top) to follow along.

See below for examples.

Norway flag

Example - Source path only

IMAGE returns an image directly to a cell.

Essentially, the first edge to touch a cell boundary limits how far the image will expand.

Vertical alignment is set to “Middle”, and Horizontal alignment is set to “Center”.

Norway flag

We have also set the row height to 30 (40 pixels).

This creates the feeling of some white space padding around the flags.

Note that sizingmustbe set to 3 before IMAGE will accept a customheightorwidth.

Norway flag

In the worksheet example, all flag images follow the same pattern.

We have also added code to generatealt_textin the form of “Flag of Canada” for each flag image.

Image caching

One quirk of the IMAGE function is that itcachesthe images it fetches inside the worksheet.

Norway flag

Instead, it doggedly returns the old (cached) image.

If you know a better way, kindly let me know.

Norway flag

The IMAGE function used to retrieve images for country flags

IMAGE function example with a custom size

IMAGE function example - generating the image path with a formula

IMAGE function example - formula with alt text

The IMAGE function used to retrieve images for country flags

IMAGE function example with a custom size

IMAGE function example - generating the image path with a formula

IMAGE function example - formula with alt text