Category: FUNCTION | Updated: 2026-11-22

How to Use the IMAGE Function: Insert and Resize Web Images Inside a Cell

Overview of the IMAGE Function

The IMAGE function takes the URL of a publicly accessible image on the internet and displays it directly inside a Google Sheets cell. It is useful for pairing data with images in product catalogs, employee directories, or QR code lists.

Syntax

=IMAGE(url, [mode], [height], [width])
  • url: The public URL ("https://...") of the image file. SVG format is not supported.
  • mode (optional): A number from 1 to 4 specifying how to size the image:
    • 1: Resize to fit inside the cell while maintaining aspect ratio (default)
    • 2: Stretch or compress to fit the entire cell, ignoring aspect ratio
    • 3: Leave at the original image size (in pixels)
    • 4: Display at the custom size (in pixels) specified by the 3rd and 4th arguments
  • height (optional): The height of the image in pixels when mode is set to 4.
  • width (optional): The width of the image in pixels when mode is set to 4.

Practical Examples with a Table

This example uses image URLs in column A and applies different display modes in columns B and C.

Cell A (Image URL) B (Fit to Cell) C (Fixed at 100×100 px)
1 Image URL Formula (Mode 1) Formula (Mode 4)
2 https://example.com/item01.png =IMAGE(A2, 1) =IMAGE(A2, 4, 100, 100)
3 https://example.com/item02.jpg =IMAGE(A3) =IMAGE(A3, 4, 80, 120)

Common Errors and Precautions

  • SVG format not supported: Raster formats like .png, .jpg, .gif, and .webp are supported, but vector .svg files will appear blank or return an error.
  • Access permission restrictions: Images on sites requiring login or servers with hotlink protection (blocking direct links) will not display.
  • Missing arguments in Mode 4 (#VALUE! error): When mode is set to 4, you must specify numeric values for both height and width, or an error will occur.

Frequently Asked Questions

Q. Can I display an image stored in Google Drive using the IMAGE function?

A. Not with the standard share URL directly. First set link sharing to 'Anyone with the link', and then convert the URL to the format https://drive.google.com/uc?export=view&id=FILE_ID to display it.

Q. How do I fit an image inside a cell while preserving its aspect ratio with IMAGE?

A. Set the second argument 'mode' to 1 (the default) to automatically resize the image to fit within the cell boundaries while maintaining its aspect ratio.