Every 15 minutes
Save invoice PDFs from Gmail to Drive, named by supplier and amount
Invoice and receipt PDFs in your inbox are saved to Drive as date_supplier_amount files, and the email is labelled as filed.
- Runs
- Every 15 minutes
- Apps
- Gmail, Google Drive
- AI
- Yes, uses the built-in AI allowance
- Access
- Gmail gmail.modify; Drive write
Send this to your assistant
Create a ClickRuntime automation: every 15 minutes, find new emails with invoice or receipt PDFs, save them to my Drive 'Invoices/2026' folder named date_supplier_amount, and label the email Filed.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A freelance consultant pays for a dozen tools and services. Receipts arrive as PDFs named invoice.pdf or 2026-0042.pdf, and at tax time she downloads each one, renames it and drags it into a folder, one evening at a time.
Saving each receipt as it arrives with a name that says who, when and how much makes the archive usable at a glance and turns tax-time prep into sharing one folder.
What you get out of it
Files you can read from the name
A name like 2026-10-14_Northwind_129.00 tells you what a file is without opening it, and sorts by date.
Your accountant gets one folder
Share the Invoices folder once instead of forwarding emails or zipping attachments at year end.
Non-invoices are left alone
Order confirmations, brochures and other PDFs are recognised and skipped, so the folder only holds real invoices.
Your inbox shows what is done
Each processed email gets a label, so you can see what has been filed and archive it with confidence.
How it works
What happens, step by step
Every 15 minutes ClickRuntime checks your Gmail for new emails with PDF attachments.
It skips emails that already carry the Filed label.
AI decides whether each attachment is an invoice or receipt and reads the supplier, date and total.
Each invoice is saved to your Drive folder with a name like 2026-10-14_Northwind_129.00, and the email is labelled Filed.
Before it runs live
- Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
- Connect Google Drive
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 Gmail and Google Drive steps into one automation
Under the hood
The code that runs this automation
import base64, json
from clickruntime import on_trigger, credentials, http, ai, report_fetched
G, FOLDER, LABEL = "https://gmail.googleapis.com/gmail/v1/users/me", "your-invoices-folder-id", "Label_Filed"
SCHEMA = {"type": "object", "properties": {"invoice": {"type": "boolean"}, "date": {"type": "string"},
"supplier": {"type": "string"}, "amount": {"type": "string"}}, "required": ["invoice", "date", "supplier", "amount"]}
@on_trigger
def run(event):
h = {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
msgs = http.get(f"{G}/messages", headers=h, params={"q": "has:attachment filename:pdf -label:Filed newer_than:7d"}).json().get("messages", [])
report_fetched(len(msgs))
if not msgs:
return {"new": 0}
saved = 0
for m in msgs:
msg = http.get(f"{G}/messages/{m['id']}", headers=h).json()
for part in [p for p in msg["payload"].get("parts", []) if p.get("filename", "").lower().endswith(".pdf")]:
info = ai.generate(f"Email snippet: {msg['snippet']}\nFile: {part['filename']}\nIs this an invoice or receipt? Extract date (YYYY-MM-DD), supplier, total.",
json_schema=SCHEMA, max_output_tokens=80).json
if not info["invoice"]:
continue
data = http.get(f"{G}/messages/{m['id']}/attachments/{part['body']['attachmentId']}", headers=h).json()["data"]
name = f"{info['date']}_{info['supplier']}_{info['amount'] or 'unknown'}.pdf"
http.post("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", headers=h, files={
"metadata": (None, json.dumps({"name": name, "parents": [FOLDER]}), "application/json"),
"file": (name, base64.urlsafe_b64decode(data), "application/pdf")})
saved += 1
http.post(f"{G}/messages/{m['id']}/modify", headers=h, json={"addLabelIds": [LABEL]})
return {"checked": len(msgs), "saved": saved}FAQ
Common questions
How does it know a PDF is an invoice?
What if it cannot read the amount?
Can it file by year automatically?
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
Transcribe emailed audio and save summaries to Drive
Voice notes and recordings sent to your inbox become a transcript and summary in Drive, with the summary emailed to you.
See how it worksFile emailed CVs in Drive with a short candidate review
Every CV sent to your jobs inbox is saved to your Candidates folder and you get an email with a short review against the role.
See how it worksTurn emailed press releases into draft articles in Drive
Press releases that reach your inbox come back as publish-ready article drafts in Google Docs, with the link emailed to you.
See how it worksKeep exploring
Set up “Save invoice PDFs from Gmail to Drive, named by supplier and amount” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.