Skip to content

Every 30 minutes

Generate images from prompts in a sheet and save them to Drive

Each new prompt you add to your Images sheet becomes an image in your Drive, with the link added to the row.

Runs
Every 30 minutes
Apps
Google Drive, Google Sheets
AI
Yes, uses the built-in AI allowance
Access
Sheets read+write; Drive write

Send this to your assistant

Create a ClickRuntime automation: for each new row in my Images sheet, generate an image from the prompt, save it to Drive and add the link to the row.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A content team plans blog headers and social images in a sheet. Each needs an illustration, so someone copies the prompt into an image tool, downloads the result, uploads it to Drive and pastes the link back. Twenty images is an afternoon gone.

Generating each image as soon as its prompt is added means the team just writes prompts. The finished images are in Drive and linked from the sheet by the time anyone looks.

What you get out of it

  • Write prompts, get images

    Adding a row is all it takes. The copy, download and upload steps disappear.

  • Everything stays organised

    Images are saved to one Drive folder and linked from the row that asked for them.

  • Easy to review in bulk

    The sheet becomes a gallery of prompts and links, so reviewing a batch takes minutes.

  • Repeatable for every campaign

    The same sheet works for every new batch. Add rows for the next campaign and the images follow.

How it works

What happens, step by step

  1. Every few minutes, ClickRuntime reads your Images sheet for rows with a prompt but no link.

  2. It generates an image for each prompt with your image service.

  3. The image is saved to your Google Drive folder.

  4. The Drive link is added to the row, so that prompt is not used again.

Before it runs live

  • Connect Google Drive
  • Connect your Google Sheets account and pick the spreadsheets it may use

What you get

RunsEvery 30 minutes
Generate images from prompts in a sheet and save them to Drivetoday, 9:00Succeeded
Google Sheets · ImagesFlat illustration of a Northwind delivery van at sunrise · https://drive.google.com/file/d/1Zx…

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Google Drive and Google Sheets steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
ai_images_from_a_sheet_saved_to_drive.pyexample
import base64
from googleapiclient.http import MediaInMemoryUpload
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, report_fetched

SHEET_ID, FOLDER_ID = "your-images-sheet-id", "your-drive-folder-id"

@on_trigger
def run(event):
    creds = Credentials(credentials.connection("google", "work"))
    values = build("sheets", "v4", credentials=creds, cache_discovery=False).spreadsheets().values()
    rows = values.get(spreadsheetId=SHEET_ID, range="Images!A2:B").execute().get("values", [])
    todo = [(i, r[0]) for i, r in enumerate(rows, start=2) if r and r[0] and len(r) < 2]
    report_fetched(len(todo))
    if not todo:
        return {"made": 0}
    drive = build("drive", "v3", credentials=creds, cache_discovery=False)
    for i, prompt in todo:
        img = http.post("https://api.openai.com/v1/images/generations", timeout=120,
                        headers={"Authorization": f"Bearer {credentials.secret('IMAGE_API_KEY')}"},
                        json={"model": "gpt-image-1", "prompt": prompt, "size": "1024x1024"}).json()["data"][0]["b64_json"]
        f = drive.files().create(body={"name": f"{prompt[:60]}.png", "parents": [FOLDER_ID]}, fields="webViewLink",
                                 media_body=MediaInMemoryUpload(base64.b64decode(img), mimetype="image/png")).execute()
        values.update(spreadsheetId=SHEET_ID, range=f"Images!B{i}", valueInputOption="RAW", body={"values": [[f["webViewLink"]]]}).execute()
    return {"made": len(todo)}

FAQ

Common questions

Which image service does it use?
The image generation service you already use, through its API key. Size and style settings can be set once or per row.
Can I regenerate an image I do not like?
Yes. Clear the link in that row and the image is made again on the next check.
Will an image be made twice?
No. Rows that already have a link are skipped.
What permissions does it need?
Sheets read+write; Drive write. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Generate images from prompts in a sheet and save them to Drive” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.