Skip to content

Every 15 minutes

Turn emailed supplier invoices into QuickBooks bills

When a supplier emails a PDF invoice, a bill is created in QuickBooks with the PDF attached, and you get an email listing what was added.

Runs
Every 15 minutes
Apps
Gmail, QuickBooks
AI
Yes, uses the built-in AI allowance
Access
Gmail modify; QBO accounting

Send this to your assistant

Create a ClickRuntime automation: every 15 minutes, check Gmail for new emails with PDF invoices, read the vendor, number, date and total with AI, create a bill in QuickBooks with the PDF attached, and email me what was created.

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 business with dozens of suppliers gets invoices by email every day. Each one means opening the PDF, finding the vendor in QuickBooks, typing the number, date and total, and saving the attachment. It's dull work, often done in batches days later, which delays payment runs and hides what you owe.

Reading the invoice and creating the bill automatically gets payables into the books the day they arrive, with the original PDF attached for anyone checking later.

What you get out of it

  • Payables are current

    Bills appear in QuickBooks the day the invoice arrives, so cash forecasts include what you actually owe.

  • The PDF is always attached

    Anyone reviewing a bill can open the original invoice from QuickBooks without searching email.

  • Hours of typing saved

    The bookkeeper reviews bills instead of entering them.

  • Nothing is processed twice

    Handled emails are labelled, so a forwarded or re-read message never becomes a second bill.

How it works

What happens, step by step

  1. Every 15 minutes, ClickRuntime checks Gmail for new emails with PDF attachments that match your invoice search.

  2. AI reads each invoice and picks out the vendor, invoice number, date and total.

  3. It finds the vendor in QuickBooks, creates the bill and attaches the PDF.

  4. It labels the email as processed so it's never handled twice.

  5. You get an email listing each bill created.

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 QuickBooks

What you get

RunsEvery 15 minutes
Turn emailed supplier invoices into QuickBooks billstoday, 9:00Succeeded
Email · Bills created2 supplier invoices processed: Northwind Supplies #INV-2291: $1,280.00, Acme Logistics #5530: $412.50

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 Gmail and QuickBooks 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.
emailed_vendor_invoices_become_quickbooks_bills.pyexample
import base64, json
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, notify, ai, report_fetched
API = "https://quickbooks.api.intuit.com/v3/company/1234567890"  # your QuickBooks company id

def qb(method, path, **kw):
    r = http.request(method, API + path, params={"minorversion": 73, **kw.pop("params", {})}, **kw, headers={"Accept": "application/json", "Authorization": "Bearer " + credentials.connection("quickbooks", "company")})
    return r.raise_for_status() or r.json()

LABEL = "Label_Processed"  # id of your "Processed" Gmail label

@on_trigger
def run(event):
    gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    msgs = gmail.users().messages().list(userId="me", q="has:attachment filename:pdf label:Invoices -label:Processed").execute().get("messages", [])
    report_fetched(len(msgs))
    if not msgs:
        return {"summary": "Nothing new"}
    created = []
    for m in msgs:
        full = gmail.users().messages().get(userId="me", id=m["id"]).execute()
        part = next(p for p in full["payload"].get("parts", []) if p.get("filename", "").lower().endswith(".pdf"))
        pdf = base64.urlsafe_b64decode(gmail.users().messages().attachments().get(userId="me", messageId=m["id"], id=part["body"]["attachmentId"]).execute()["data"])
        f = ai.generate(f"From this invoice email return JSON with vendor, number, date (YYYY-MM-DD), total:\n{full['snippet']}", max_output_tokens=120,
                        json_schema={"type": "object", "properties": {"vendor": {"type": "string"}, "number": {"type": "string"}, "date": {"type": "string"}, "total": {"type": "number"}}}).json
        vendors = qb("GET", "/query", params={"query": f"select * from Vendor where DisplayName = '{f['vendor']}'"})["QueryResponse"].get("Vendor")
        if vendors:
            bill = qb("POST", "/bill", json={"VendorRef": {"value": vendors[0]["Id"]}, "DocNumber": f["number"], "TxnDate": f["date"], "Line": [{"Amount": f["total"],
                      "DetailType": "AccountBasedExpenseLineDetail", "AccountBasedExpenseLineDetail": {"AccountRef": {"value": "7"}}}]})["Bill"]
            meta = {"AttachableRef": [{"EntityRef": {"type": "Bill", "value": bill["Id"]}}], "FileName": part["filename"], "ContentType": "application/pdf"}
            qb("POST", "/upload", files={"file_metadata_0": (None, json.dumps(meta), "application/json"), "file_content_0": (part["filename"], pdf, "application/pdf")})
        created.append(f"{f['vendor']} #{f['number']}: ${f['total']:,.2f}" + ("" if vendors else " (vendor not found, skipped)"))
        gmail.users().messages().modify(userId="me", id=m["id"], body={"addLabelIds": [LABEL]}).execute()
    notify.email_me(f"{len(created)} supplier invoices processed", "\n".join(created))
    return {"processed": len(created)}

FAQ

Common questions

Which emails are treated as invoices?
Emails with PDF attachments matching your Gmail search, such as from known supplier addresses or with an Invoices label.
What if the vendor isn't in QuickBooks?
The email is skipped and listed in your summary so you can add the vendor and let the next run pick it up.
Can I approve bills before they're created?
Yes. Ask for an approval step in Slack or a sheet, and the bill is only created once someone approves.
What permissions does it need?
Gmail modify; QBO accounting. 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 emailed supplier invoices into QuickBooks bills” from your assistant

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