ID EN
#Dynamic array

IMAGE

Excel Functions

Retrieve image to Excel from the Internet

Syntax

EXCEL
=IMAGE(source, [alt_text], [sizing], [height], [width])

Arguments

Parameter Description
source Path to image as a URL.
alt_text [optional] Text to describe the image for accessibility.
sizing [optional] 0 = Fit to cell, 1 = Fill cell, 2 = Original size, 3 = Custom size.
height [optional] Height of the image in pixels.
width [optional] Width of the image in pixels.

Return Value

The image at the given path

Details

The IMAGE function is Excel's solution for adding images to a worksheet with a formula. IMAGE is similar in some ways to HTML's tag, which is used to add images to an HTML page. Like the tag, the IMAGE function allows you to set the image path and provide options for fit and size. IMAGE supports many file formats, including BMP, JPG, JPEG, GIF, TIFF, PNG, ICO, and WEBP. The images must be available online and reachable with the "https://" protocol. As long as the path is valid and accessible, IMAGE will fetch the image and bring a copy of it into a cell on the worksheet. You can use the IMAGE function to add images to things like employee lists, product information, games, and other data that includes images. Of course, you can manually insert an image into a cell anytime, so why use IMAGE

Examples

Simple Example

In its simplest form, the IMAGE function requires just the path to an image:

EXCEL
=IMAGE(source)
Simple Example

For example, to retrieve an image of the Norwegian flag (which exists on this website as the file "flag_norway.png", you can use the IMAGE function li

EXCEL
=IMAGE("https://exceljet.net/sites/default/files/flag_norway.png")
Example - Source path only

IMAGE returns an image directly to a cell. In the worksheet below, you can see an example of using the IMAGE function to return six different country

EXCEL
=IMAGE(C5)
Example - Formula to generate source path

Because IMAGE accepts a path to an image as plain text, this text can be created programmatically with another formula. This is useful when the path t

EXCEL
flag_canada.png
flag_united_states.png
flag_germany.png
flag_united_kingdom.png
flag_mexico.png
flag_france.png
Example - Formula to generate source path

In addition, the path always begins with the same text:

EXCEL
"https://exceljet.net/sites/default/files/"
Example - Formula to generate source path

Because we already have the country names in column B, and because the flag images are consistently named, we have what we need to assemble each image

EXCEL
=SUBSTITUTE("https://exceljet.net/sites/default/files/flag_xxxx.png",
"xxxx",SUBSTITUTE(LOWER(B5)," ","_"))