Google Sheets function · Google-only
IMAGE in Google Sheets: syntax and examples
IMAGE puts a picture from a url into a cell, and the picture stays tied to the cell when you sort or resize. The mode argument decides whether it fits, stretches, keeps its size or uses a size you set.
Syntax
IMAGE(url, [mode], [height], [width])
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
url | text | yes | The web address of the image, in quotes and starting with https://. A cell reference works too. |
mode | number | no | 1 fits the cell and keeps proportions (default). 2 stretches to the cell. 3 uses the original size. 4 uses height and width. |
height | number | no | Height in pixels, used only with mode 4. |
width | number | no | Width in pixels, used only with mode 4. |
Examples
The examples use this table, starting in A1:
| Image URL |
| https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png |
=IMAGE("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png")Result: (image in cell)
The simplest call: the image shrinks to fit the cell and keeps its proportions.
Run in a Google Sheet (English US locale) on .
=IMAGE("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", 2)Result: (image in cell)
Mode 2 stretches the image to fill the whole cell, so it can look distorted.
Run in a Google Sheet (English US locale) on .
=IMAGE("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", 3)Result: (image in cell)
Mode 3 keeps the original size and crops what does not fit.
Run in a Google Sheet (English US locale) on .
=IMAGE("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", 4, 40, 120)Result: (image in cell)
Mode 4 sets the size in pixels: 40 high and 120 wide.
Run in a Google Sheet (English US locale) on .
=IMAGE(A2)Result: (image in cell)
The url is read from a cell, which suits a column of product photos.
Run in a Google Sheet (English US locale) on .
Common errors
- mode only accepts 1, 2, 3 or 4. Any other number, such as 5, returns #VALUE!.
- Mode 4 needs both height and width. Writing IMAGE(url, 4) alone returns #N/A.
- The url must point to a public image file. Links that need a login do not load.
- Height and width are in pixels, so a tall row height is needed to see a large image.
Compared with Excel
Excel has no IMAGE formula in older versions. Excel 365 has IMAGE with a different mode scheme (alt text, sizing, height, width).