How to Use the IMAGE Function in Google Sheets

Published on

In Google Sheets, you can insert in-cell images primarily in two ways: using the IMAGE function or by navigating to Insert > Image > Insert an Image in the Cell. Both methods allow you to display images within cells, and these images can be used in lookup functions like VLOOKUP.

The Insert > Image option lets you add images from various sources, such as your computer, Google Drive, or by providing a URL. However, the IMAGE function requires a URL specifically.

The advantage of the function is that it gives you control over the display size and aspect ratio of the image within the cell, which isn’t possible through the Insert menu. Here’s a detailed tutorial on using the IMAGE function in Google Sheets.

IMAGE Function Syntax

Syntax:

IMAGE(url, [mode], [height], [width])

There are four arguments in the IMAGE function. Let’s go over them with examples.

Arguments and Examples:

URL

This is the URL of the image you want to display in the cell.

Example: To display an image from a URL, such as this one:

=IMAGE("https://infoinspired.com/wp-content/uploads/2024/04/iso-logo-ii-4.png")

Alternatively, if you place the URL in cell A1, you can use:

=IMAGE(A1)

Note: Make sure the URL is not enclosed in double quotes if it’s referenced in a cell.

MODE

The mode argument controls how the image is resized within the cell. Here are the options:

  • 1 (default): Resizes the image to fit within the cell while maintaining the aspect ratio. This is often the best option for a clear display.
    =IMAGE("https://infoinspired.com/wp-content/uploads/2024/04/iso-logo-ii-4.png", 1)
  • 2: Stretches or compresses the image to fill the cell, ignoring the aspect ratio.
    =IMAGE("https://infoinspired.com/wp-content/uploads/2024/04/iso-logo-ii-4.png", 2)
  • 3: Displays the image in its original size, which may cause cropping if the image exceeds cell dimensions. To view the entire image, adjust the cell size accordingly.
    =IMAGE("https://infoinspired.com/wp-content/uploads/2024/04/iso-logo-ii-4.png", 3)
  • 4: Allows you to specify custom dimensions in pixels for height and width, which can be useful when resizing images to specific sizes.
    =IMAGE("https://infoinspired.com/wp-content/uploads/2024/04/iso-logo-ii-4.png", 4, 25, 25)
    • Height
      (Only for mode 4) Sets the image height in pixels.
    • Width
      (Only for mode 4) Sets the image width in pixels.
IMAGE function and its modes in Google Sheets

Using the IMAGE Function with Dynamic Arrays

If you have a series of images stored in the same folder with sequential naming (e.g., iso-logo-ii-1.png, iso-logo-ii-2.png, etc.), you can use the IMAGE and SEQUENCE functions together to load all images in their own cells dynamically.

Example:

=ARRAYFORMULA(IMAGE("https://infoinspired.com/wp-content/uploads/2024/04/iso-logo-ii-" & SEQUENCE(4) & ".png"))

Note: You cannot use volatile functions (e.g., NOW, RAND, RANDARRAY, COINFLIP) in the base URL for the IMAGE function, as they cause the URL to update constantly, which the IMAGE function does not support.

Using the IMAGE Function with Lookup Functions

The IMAGE function enables in-cell images to be used with lookup functions like VLOOKUP, XLOOKUP, LOOKUP, and HLOOKUP. This can help display images based on a lookup value.

Example: If cell A1 contains the text “logo” and cell B1 contains an IMAGE formula, you can use:

=VLOOKUP("logo", A1:B1, 2, FALSE)

Or with XLOOKUP:

=XLOOKUP("logo", A1, B1)

This technique is useful for displaying images such as meal photos based on the selected meal in a restaurant menu, country flags by country names in a list, and more.

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

Mode of Comma-Separated Numbers in Excel (Dynamic Array)

There is no dedicated function in Excel to directly find the mode of comma-separated...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

More like this

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

1 COMMENT

  1. Good information. But is there any way through which I can copy images from one spreadsheet to another spreadsheet in google sheets on mobile?

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.