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.
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
Every few minutes, ClickRuntime reads your Images sheet for rows with a prompt but no link.
It generates an image for each prompt with your image service.
The image is saved to your Google Drive folder.
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
Build your own
Need it to work differently?
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
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?
Can I regenerate an image I do not like?
Will an image be made twice?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Turn invoices dropped in a Drive folder into expense rows
Any invoice or receipt you drop into a Drive folder becomes a row in your expenses sheet with supplier, date, amount and VAT.
See how it worksScore CVs from a Drive folder into a spreadsheet
Every CV added to your Applicants folder becomes a row in your sheet with contact details, skills, experience and a score against the role.
See how it worksWrite social captions for images you drop in Drive
Each image you add to your Drive Posts folder gets a caption and hashtags in your Content sheet, ready to post.
See how it worksKeep exploring
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.