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 Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Marking Case-Sensitive Unique Values in Excel

Marking case-sensitive unique values provides several benefits compared to merely extracting them in an...

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Compare Two Tables for Differences in Excel

To compare two tables with similar data for differences, you can use the XLOOKUP...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

More like this

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

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.