Automate inline image previews in your spreadsheet

Table of contents
CE

Managing visual data alongside text records can be tricky—especially when working with images stored in Google Drive. If your spreadsheet lists image file names in Column A and their Google Drive URLs in Column B, you can automate inline previews directly in your sheet. Here’s how.

The setup

Let’s say you have a structured spreadsheet:

  • Column A – The exact file name of each image (matching its Google Drive name).
  • Column B – The full Google Drive URL of each image.

Instead of manually clicking each URL, you can automate image previews using a simple Google Sheets formula that combines the IMAGE function and REGEXEXTRACT.

How to enable inline image previews

1. Set up your spreadsheet

Make sure your spreadsheet follows this structure:

File Name 

Google Drive URL 

Image Preview 

image1.jpg

https://drive.google.com/file/d/xyz123/view

(will display image preview)

2. Extract the image id from Google Drive URLs

Google Drive URLs contain a unique image ID, which you need to extract for embedding. The standard format for displaying an image looks like this:

=IMAGE(“https://drive.google.com/uc?id=image-id”)

3. Automate image extraction with REGEX

Since Column B contains the full URL, you can use the REGEXEXTRACT function to isolate the image ID automatically. In Column C, enter this formula:

=IMAGE(“https://drive.google.com/uc?id=”&REGEXEXTRACT($B$2,”d/([a-zA-Z0-9_-]+)”))

How this works:

  • IMAGE – Displays an image from a URL directly in a cell.
  • REGEXEXTRACT(B2, “d/([a-zA-Z0-9_-]+)”) – Extracts the unique image ID from the URL in Column B.
  • & (concatenation) – Joins the extracted ID with the IMAGE function’s required URL format.

Here’s the final result : 

automate inline images in spreadsheets 1

Why this matters

By automating image previews, you save time, reduce errors, and create a more streamlined workflow. This method is perfect for managing large datasets efficiently—helping you focus on insights instead of manual tasks.

Start automating today for a smoother, smarter spreadsheet experience!

You may also like…