Generate AI Images in Google Sheets
Use the =AIIMAGE() formula to generate product mockups, social media visuals, and ad creative at scale. One formula per cell, drag down for hundreds of images.
Phil Nguyen · 9 min read · Updated

You need 50 product images for a new catalog. Your designer is booked for two more weeks. Stock photos all look the same. And making them one by one in a separate image app means 50 rounds of copy, paste, download, rename, and upload.
What if you could type a formula into a cell and get an image back? The same way =SUM() gives you a number?
That is what =AIIMAGE() does. It takes a text description, sends it to an image generation model, and puts the result right in your cell. One formula per image. Drag it down a column and your whole catalog gets visuals in minutes.
Your first AI-generated image
Formula
=AIIMAGE("A minimalist product photo of a ceramic coffee mug, white background, soft studio lighting, centered composition")Generates an image from the text description and displays it directly in the cell. Powered by GPT Image or a Gemini image model, depending on your selected provider.
That is the whole thing. No API keys to set up on the free tier. No image editor. No downloads. The image lives in your spreadsheet right next to the data it came from.
Note
=AIIMAGE() works with OpenAI (GPT Image 2, GPT Image 1.5, GPT Image 1 Mini) and Google Gemini (Gemini 3 Pro Image, Gemini 3.1 Flash Image, Gemini 3.1 Flash-Lite Image). Your selected provider in Extensions > SheetMagic > Open AI Settings controls which model creates the image. You can switch providers anytime. The formula stays the same.
Writing prompts that make usable images
The gap between a generic image and a good one comes down to your prompt. AI image models do best with specific, structured descriptions. Here is a pattern that works well:
Subject + Style + Background + Lighting + Composition
| Element | Weak | Strong |
|---|---|---|
| Subject | "a shoe" | "a white leather running shoe with teal accents" |
| Style | (nothing) | "flat design illustration" or "product photography" |
| Background | (nothing) | "solid white background" or "gradient from navy to black" |
| Lighting | (nothing) | "soft studio lighting" or "natural window light from the left" |
| Composition | (nothing) | "centered, slightly angled, with subtle shadow" |
Put them all together in one prompt:
Formula
=AIIMAGE("Product photography of a white leather running shoe with teal accents, solid white background, soft studio lighting, centered with subtle shadow")A structured prompt that gives the model enough specificity to generate a clean, consistent product image.
Tip
Keep prompts under 75 words. Image models do better with shorter, more specific descriptions than long paragraphs. Focus on what you see, not what you feel.
Batch image generation: 50 product images from a spreadsheet
This is where =AIIMAGE() really shines compared to standalone AI image tools. In Midjourney or ChatGPT, 50 images means 50 separate prompts typed into a chat window. In a spreadsheet, you build the prompt once and let the data fill in the rest.
The setup
| Column A | Column B | Column C |
|---|---|---|
| Product Name | Product Details | Image (formula) |
| Titanium Travel Mug | 16oz, matte black, double-walled | =AIIMAGE(...) |
| Bamboo Cutting Board | 14x10 inches, natural grain, handles | =AIIMAGE(...) |
| Wireless Earbuds Pro | White case, metallic silver buds, compact | =AIIMAGE(...) |
The formula
Formula
=AIIMAGE("Product photography of "&A2&", "&B2&". Solid white background, soft studio lighting, centered composition, e-commerce style.")Concatenates the product name and details into a dynamic prompt. Each row generates a unique image tailored to that product.
That is it. Type this formula in C2, drag it down to C51, and 50 product images generate at the same time. Each one pulls from that row's product name and details, so every image is different.
Prepare your product data
Put product names in column A and key visual details (color, material, size, standout features) in column B. The more specific column B is, the better your images will turn out.
Write the formula in C2
Use the formula above, pointing to A2 and B2. Press Enter and wait for the first image. Look at it carefully. If the style is not right, tweak the prompt template before you scale up.
Drag the formula down
Once the first image looks good, grab the fill handle on C2 and drag it down to cover all your products. Each row generates on its own using its own product data.
Refine selectively
Some images will need tweaking. Edit the product details in column B to be more specific (add colors, materials, angles) and the image regenerates on its own.
Caveat
Each =AIIMAGE() call uses AI tokens from your plan. Generating 50 images at once works great on paid plans (Solo gets 3.25M tokens/month). The free tier's 20,000 one-time tokens are less than one image costs on most models, so image work needs a paid plan.
Five use cases beyond product photos
1. Social media visuals at scale
Plan a whole month of social content in your spreadsheet. Then generate matching visuals in the next column:
Formula
=AIIMAGE("Social media graphic for: "&A2&". Modern flat design, vibrant colors, 1:1 aspect ratio, minimal text space at the bottom")A2 contains the post topic. Each row generates a unique social media graphic that matches the content plan.
2. Ad creative variations
Test different visual ideas for the same product by changing up the prompt:
Formula
=AIIMAGE(A2&", "&B2&" style, "&C2&" background, professional advertising photography")A2 has the product, B2 has the style variation (lifestyle, studio, flat lay), C2 has the background color. Mix and match for rapid creative testing.
3. Blog post hero images
Make custom header images for articles instead of reaching for stock photos:
Formula
=AIIMAGE("Blog header illustration for an article about "&A2&". Abstract, modern, blue and purple gradient, wide format, no text")A2 contains the article topic. Generates a unique, on-brand header image.
4. Presentation slide visuals
Build all your slide deck visuals from an outline:
Formula
=AIIMAGE("Clean presentation slide background for the topic: "&A2&". Subtle, professional, light gradient, space for text overlay")Generates slide backgrounds that match each section of your presentation outline.
5. Placeholder mockups for prototyping
Need UI mockups or wireframe-style visuals before the design team gets started?
Formula
=AIIMAGE("Simple wireframe mockup of a mobile app screen showing "&A2&". Black and white, clean lines, minimal UI elements")Quick visual prototypes directly from feature descriptions.
Chaining AIIMAGE with other formulas
Things get really fun when you combine =AIIMAGE() with other SheetMagic formulas. You can let the AI write the image prompt for you:
Formula
=AIIMAGE(AITEXT("Write an image generation prompt for a product photo of: "&A2&". Include specific details about style, background, and lighting. Keep it under 50 words. Return only the prompt.", B2))AITEXT generates an optimized image prompt from your product data, then AIIMAGE generates the image. Fully automated -- you provide the product name, the AI handles the rest.
Or scrape a competitor's product page and generate a similar-style image for your own product:
Formula
=AITEXT("Describe the visual style of the product imagery on this page in 30 words. Include background, lighting, and composition details.", VISIT(A2))Scrapes a competitor page and extracts their visual style. Use this description as a template for your own AIIMAGE prompts.
Tips for consistent results
Use a template prompt. Write one prompt structure and pull in cell data for the parts that change. This keeps your images looking consistent across dozens of rows.
Say what you do not want. Add "no text," "no watermark," or "no people" if those things keep showing up. Negative instructions work well with image models.
Include style references. Phrases like "product photography style," "flat design illustration," "isometric 3D render," and "watercolor painting" are all reliable anchors. They help the model stay consistent.
Pick the right provider for the job. OpenAI gives you GPT Image 2, GPT Image 1.5, and GPT Image 1 Mini. Google gives you Gemini 3 Pro Image, Gemini 3.1 Flash Image, and Gemini 3.1 Flash-Lite Image. Switch providers in Extensions > SheetMagic > Open AI Settings to try them out.
Edit to regenerate. If an image is not right, tweak column B (your product details) or adjust the prompt template. The formula recalculates on its own and makes a new image.
Working with Generated Images
AIIMAGE returns a URL. Here are ways to use it:
Click to view: The link opens the full-resolution image in your browser.
Download: Right-click the link in Sheets and open in a new tab, then save the image.
Embed in documents: Copy the URL into Google Docs, Slides, or any tool that accepts image URLs.
Batch download: For large batches, use the URLs as a download list with any bulk download tool.
Limitations to Know About
AI-generated images aren't perfect. Expect occasional artifacts: extra fingers on hands, distorted text, unusual proportions. For catalog or marketing use, review the batch and regenerate the ones that don't pass quality checks.
Text in images is unreliable. If your prompt includes words you want to appear in the image ("a sign that says SALE"), the result is often misspelled or garbled. Add text overlays separately in a design tool.
Style consistency has limits. While using the same prompt template helps, AI models don't produce pixel-identical styles across generations. For brand-critical work, use generated images as starting points and refine in a design tool.
Generation time. Image generation takes longer per cell than text generation. For batches, see our guide to processing large batches.
Getting started
You can install SheetMagic free, no credit card needed, and try the text formulas above on 20,000 AI tokens. One image on most models costs more than that, so =AIIMAGE() work needs a paid plan.
Note
Ready to try it? Install SheetMagic free, open a spreadsheet, and paste this into any cell:
=AIIMAGE("A friendly robot sitting at a desk using a spreadsheet, digital illustration, soft colors")
Your first AI-generated image will show up in seconds.
When you are ready for batch generation, paid plans start at $20/month with 3.25 million AI tokens. See the pricing page for the full breakdown.
For the complete formula reference covering all SheetMagic functions, read the complete guide to AI formulas in Google Sheets. To get started with installation and your first formulas, see getting started with AI in Google Sheets.
Have questions? visit the FAQ for answers about AI formulas, image generation, providers, and billing.
Text and scraping formulas run on the free allowance. Install from the Google Workspace Marketplace, no card, no expiry.
Install free for Google SheetsAbout the author
Phil NguyenPhil builds SheetMagic, the Google Sheets add-on that brings AI and web scraping into the spreadsheet, used by 6,300+ people. He writes these guides from the formulas he runs on his own sheets.
