Generate images from a Google Sheets cell (AI_IMAGE)
You can generate images from a Google Sheets formula. The cell returns a URL, you wrap it in =IMAGE(), and the picture renders inline. Useful for product mockups, social media variants, hero-image AB tests, and a hundred marketing chores that used to require switching tabs.
The one-line version
=IMAGE(AI_IMAGE("a red sports car at sunset, cinematic"))
=AI_IMAGE generates the image and returns a public URL. =IMAGE renders it in the cell. Inner workings:
- Default model: Gemini 2.5 Flash Image Preview ("Nano Banana") — fast, generous rate limits, free-tier-friendly.
- Output bytes are saved to your Google Drive as a public read-only image and returned as a Drive URL.
- Drive URL works in
=IMAGE()indefinitely.
Choosing a model
# Default — Gemini Nano Banana
=AI_IMAGE("a watercolor of a wolf")
# DALL-E 3 — sharper composition for product shots
=AI_IMAGE("product photo of a leather wallet on white", "1024x1024", "dall-e-3")
# Imagen 3 — best for photoreal portraits
=AI_IMAGE("portrait of an elderly fisherman, photo-realistic", "", "imagen-3.0-generate-002")
All three work from a single formula. Pick the model that fits the style. Gemini is cheapest, DALL-E 3 is best for clean product shots, Imagen 3 wins on photoreal humans.
Real-world uses
Product mockup variants
Column A: 50 product taglines. Column B: =IMAGE(AI_IMAGE("hero banner showing " & A2 & ", minimalist style, white background")). Scan 50 visual variants in a single view.
Persona avatars
Column A: persona names. Column B: =IMAGE(AI_IMAGE("professional headshot of " & A2 & ", neutral background")). Quick visual personas for design reviews.
Social variants
One sheet with blog post titles. Generate 3 image variants per post for OpenGraph + Twitter cards. Pick the winner.
Marketing AB tests
Spreadsheet of headline + image pairs → run through your CMS or paid-ad system. Faster than booking time with a designer for variants.
Cost
| Model | Per image | 100 images |
|---|---|---|
| Gemini 2.5 Flash Image | ~$0.00 | $0 (free tier) |
| DALL-E 3 (1024×1024) | $0.04 | $4.00 |
| Imagen 3 | $0.04 | $4.00 |
Gemini Nano Banana has a free quota that covers casual use entirely. If you're generating 1,000+ images, mix DALL-E for hero shots + Gemini for variants to balance quality and cost.
Pitfalls
Drive permissions
The default "anyone with the link" sharing is required for =IMAGE() to fetch the URL. If your Workspace admin blocks external link sharing, image cells will show a broken image icon. Workaround: download the image, upload it to a publicly-readable host, paste that URL.
Cell timeout
Image generation takes 4–15 seconds per call. Sheets has a 30-second cell-formula cap, which is usually fine — but on bad days, calls time out. Use the sidebar's Bulk runner for batch generation; no cell-level cap.
Recalculation
Each recalculation regenerates the image (different output every time). To freeze: Cmd+Shift+V on the cell to paste as value, locking the URL.
Content policy
Each provider has its own content filter. Same prompt may succeed on Gemini and fail on DALL-E (or vice versa). If you hit a block, switch providers via the model parameter.
Tier note
=AI_IMAGE is in the Premium tier ($99 lifetime). Same tier includes =AI_VISION (analyze images) and =AI_WEB (web-searched answers).