How to Preview Google Drive Images in Google Sheets Dynamically using Formula

How to Preview Google Drive Images in Google Sheets Dynamically using Formula

Displaying images hosted on Google Drive directly in Google Sheets can streamline workflows for content management, product catalogs, or project dashboards. However, the traditional =IMAGE()method often fails with standard Drive links. In this guide, you’ll learn a reliable formula to dynamically render Drive-hosted images in Sheets while optimizing your process for efficiency.


Why the Old Method Fails

Previously, users tried embedding Drive images using the standard “view” link:

=IMAGE("https://drive.google.com/file/d/1A1_OJB3.../view")  

This rarely works because Google Sheets cannot process the /view endpoint. Instead, you need the direct image URL, which uses the uc?id= parameter.


The Solution: Combine IMAGE + REGEXEXTRACT

By extracting the unique file ID from your Drive link and appending it to Google’s direct image URL, you can display images seamlessly. Here’s how:

  1. Place Your Drive Link in a Cell
    Example: Paste https://drive.google.com/file/d/1TY11t3YHHZYtD.../view into cell A2.
  2. Use This Formula:
=IMAGE("https://drive.google.com/uc?id=" & REGEXEXTRACT(A2, "d/(.*?)/"))

Troubleshooting Tips

  • Invalid Link? Ensure your Drive URL is shared with “Anyone with the link” permissions.
  • Formula Errors: Double-check for typos in REGEXEXTRACT or extra characters in the URL.

FAQ

Q: Will this method work for PDFs or videos?
A: No—this technique is optimized for image files (JPEG, PNG, etc.).

Q: Can I use shortened Drive links?
A: No. The formula requires the full URL to extract the file ID.

Q: Is this compliant with Google’s policies?
A: Yes, as long as you have rights to share the images.