Skip to content

Every 15 minutes

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.

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

Send this to your assistant

Create a ClickRuntime automation: every 15 minutes, check my Drive 'Invoices' folder for new PDFs or images, pull out the supplier, date, amount and VAT, and add them to my expenses sheet.

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 sole trader photographs receipts on the go and saves supplier PDFs into a Drive folder. At the end of each quarter she spends an evening opening every file and typing figures into a spreadsheet for her VAT return, and still finds a few she missed.

This automation reads each new file as it lands in the folder and adds a row to your expenses sheet. By the end of the quarter the sheet is already complete.

What you get out of it

  • VAT returns without the quarter-end scramble

    Expenses are logged as they come in, so the figures are ready when the return is due.

  • Save the file, that is all

    Dropping a photo or PDF into a folder from your phone is the only step. No forms, no typing on a small screen.

  • A link back to every receipt

    Each row links to its file, so your accountant can check any figure against the original.

  • Each file handled once

    Processed files are marked in Drive, so they are never logged twice even if the folder is reorganised.

How it works

What happens, step by step

  1. Every 15 minutes ClickRuntime checks your Drive 'Invoices' folder for files added since the last check.

  2. AI reads each invoice or receipt and picks out the supplier, date, total and VAT.

  3. Each file is marked as processed in Drive so it is never logged twice.

  4. A row with the details and a link to the file is added to your expenses sheet.

Before it runs live

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

What you get

RunsEvery 15 minutes
Turn invoices dropped in a Drive folder into expense rowstoday, 9:00Succeeded
Google Sheets · ExpensesNorthwind Office Supplies · 2026-10-17 · £96.00 · VAT £16.00 · receipt-1017.jpg

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.
invoices_dropped_in_drive_extracted_to_a_sheet.pyexample
import base64
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, ai, state, report_fetched

FOLDER_ID, SHEET_ID = "your-invoices-folder-id", "your-spreadsheet-id"
SCHEMA = {"type": "object", "properties": {k: {"type": "string"} for k in ("supplier", "date", "total", "vat")}}

@on_trigger
def run(event):
    creds = Credentials(credentials.connection("google", "work"))
    drive = build("drive", "v3", credentials=creds, cache_discovery=False)
    since = state.get("since") or "2026-01-01T00:00:00"
    q = f"'{FOLDER_ID}' in parents and createdTime > '{since}' and not properties has {{key='logged' and value='yes'}}"
    files = drive.files().list(q=q, orderBy="createdTime", fields="files(id,name,createdTime,webViewLink)").execute().get("files", [])
    report_fetched(len(files))
    if not files:
        return {"logged": 0}
    rows = []
    for f in files:
        text = drive.files().export(fileId=drive.files().copy(fileId=f["id"], body={"mimeType": "application/vnd.google-apps.document"}).execute()["id"],
                                    mimeType="text/plain").execute().decode()[:6000]
        x = ai.generate(f"Extract supplier, date (YYYY-MM-DD), total and VAT from this invoice:\n{text}", json_schema=SCHEMA, max_output_tokens=120).json
        rows.append([x.get("supplier"), x.get("date"), x.get("total"), x.get("vat"), f["webViewLink"]])
        drive.files().update(fileId=f["id"], body={"properties": {"logged": "yes"}}).execute()
    build("sheets", "v4", credentials=creds, cache_discovery=False).spreadsheets().values().append(
        spreadsheetId=SHEET_ID, range="Expenses!A:E", valueInputOption="USER_ENTERED", body={"values": rows}).execute()
    state.set("since", files[-1]["createdTime"][:19])
    return {"logged": len(rows)}

FAQ

Common questions

Which file types work?
PDFs and photos such as JPG and PNG. Clear photos work well; very blurry ones may need a figure filled in by hand.
What if a field cannot be read?
The row is still added with the fields that were found, and the rest are left blank for you to complete.
Can I use subfolders by month?
Yes. It can watch a parent folder and its subfolders, so you can keep files organised however you like.
What permissions does it need?
Drive read+write; Sheets read+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 “Turn invoices dropped in a Drive folder into expense rows” from your assistant

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