Generate AI Product Ad Images from Google Sheets using Fal.ai and OpenAI

⚠️ Note: All sensitive credentials should be set via n8n Credentials or environment variables. Do not hardcode API keys in nodes.

Who’s it for

Marketers, creators, and automation builders who want to generate UGC-style ad images automatically from a Google Sheet. Ideal for e‑commerce SKUs, agencies, or teams that need many variations quickly.

What it does (Overview)

This template turns a spreadsheet row into ad images ready for campaigns.

Zone 1 — Create Ad Image**: Reads product rows, downloads image, analyzes it, generates prompts, appends results back into Google Sheet. Zone 2 — Create Image (Fal nano‑banana)**: Generates ad image variations, polls Fal.ai API until done, uploads to Drive, and updates sheet with output URLs.

Requirements

Fal.ai API key** (env: FAL_KEY) Google Sheets / Google Drive** OAuth2 credentials OpenAI (Vision/Chat)** for image analysis A Google Sheet with columns for product and output Google Drive files set to Anyone with link → Viewer so APIs can fetch them

How to set up

Credentials: Add Google Sheets + Google Drive (OAuth2), Fal.ai (Header Auth with Authorization: Key {{$env.FAL_KEY}}), and OpenAI. Google Sheet: Create sheets with the following headers.

Sheet: product

product_id | product_name | product_image_url | product_description | campaign | brand_notes | constraints | num_variations | aspect_ratio | model_target | status

Sheet: ad_image

scene_ref | product_name | prompt | status | output_url

Import the workflow: Use the provided JSON. Confirm node credentials resolve. Run: Start with Zone 0 to verify prompt-only flow, then test Zone 1 for image generation.

Zone 1 — Create Ad Image (Prompt-only)

Reads product row, normalizes Drive link, analyzes image, generates structured ad prompts, appends to ad_image sheet.

Zone 2 — Create Image (Fal nano‑banana)

Reads product row, converts Drive link, generates image(s) with Fal nano‑banana, polls until complete, uploads to Drive, updates sheet.

Node settings (high‑level)

Drive Link Parser (Set)

{{ (() => { const u = $json.product || ''; const q = u.match(/[?&]id=([-\w]{25,})/); const d = u.match(//d/([-\w]{25,})/); const any = u.match(/[-\w]{25,}/); const id = q?.[1] || d?.[1] || (any ? any[0] : ''); return id ? 'https://drive.google.com/uc?export=view&id=' + id : ''; })() }}

How to customize the workflow

Adjust AI prompts to change ad style (luxury, cozy, techy). Change aspect ratio for TikTok/IG/Shorts (9:16, 1:1, 16:9). Extend Sheet schema for campaign labels, audiences, hashtags. Add distribution (Slack/LINE/Telegram) after Drive upload.

Troubleshooting

JSON parameter needs to be valid JSON** → Ensure expressions return objects, not strings. 403 on images** → Make Drive files public (Viewer) and convert links. Job never completes* → Check status_url, retry with -fast models or off‑peak times.

Template metadata

Uses:** Google Sheets, Google Drive, HTTP Request, Wait/If/Switch, Code, OpenAI Vision/Chat, Fal.ai models (nano‑banana)

Visuals

Workflow Diagram

Example Product Image

Product Image - nano Banana

0
Downloads
0
Views
8.01
Quality Score
intermediate
Complexity
Author:Jaruphat J.(View Original →)
Created:9/26/2025
Updated:12/9/2025

🔒 Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments