Every 15 min + polling the sheet
Log emailed supplier invoices in a sheet and create bills once approved
Supplier invoices from your inbox are logged as rows in your payables sheet, and each one becomes a QuickBooks bill when you mark it Approved.
- Runs
- Every 15 min + polling the sheet
- Apps
- Google Sheets, QuickBooks
- AI
- Yes, uses the built-in AI allowance
- Access
- accounting write; sheet editor; Gmail read
Send this to your assistant
Create a ClickRuntime automation: every 15 minutes, read new invoice emails, pull out vendor, amount and due date with AI and add a row to my AP sheet; when I mark a row Approved, create the bill in QuickBooks.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Supplier invoices arrive by email to whoever placed the order. Some get forwarded to the bookkeeper, some get lost, and a few are paid twice. Nobody has a single list of what's owed and what's been approved.
Logging each invoice in a shared payables sheet gives one list to review. Creating the QuickBooks bill only after someone marks it Approved keeps control with a person while removing the data entry.
What you get out of it
One list of what you owe
Every emailed invoice lands in the same sheet, so nothing is lost in a personal inbox.
Approval stays with you
Bills reach QuickBooks only after someone marks them Approved, so unchecked invoices never enter the books.
No typing from PDFs
Vendor, amount and due date are filled in for you, leaving only a check.
Fewer double payments
A bill number recorded against each row shows at a glance which invoices are already in QuickBooks.
How it works
What happens, step by step
Every 15 minutes, ClickRuntime checks your Gmail for new emails with the Invoices label.
AI reads each email and picks out the vendor, amount and due date.
It adds a row for each invoice to your AP sheet, with the status left as New.
When you change a row's status to Approved, the next run creates the bill in QuickBooks and marks the row Done.
Emails and rows already handled are remembered, so nothing is logged or billed twice.
Before it runs live
- Connect your Google Sheets account and pick the spreadsheets it may use
- Connect QuickBooks
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 Sheets and QuickBooks steps into one automation
Under the hood
The code that runs this automation
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state, ai, report_fetched
SHEET_ID = "your-spreadsheet-id"
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()
SCHEMA = {"type": "object", "properties": {"vendor": {"type": "string"}, "amount": {"type": "number"}, "due": {"type": "string"}}}
@on_trigger
def run(event):
gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
sheets = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).spreadsheets()
done = set(state.get("done") or [])
msgs = [m for m in gmail.users().messages().list(userId="me", q="label:Invoices newer_than:7d").execute().get("messages", []) if m["id"] not in done]
rows = sheets.values().get(spreadsheetId=SHEET_ID, range="AP!A2:E").execute().get("values", [])
approved = [(i, r) for i, r in enumerate(rows, start=2) if len(r) >= 4 and r[3] == "Approved"]
report_fetched(len(msgs) + len(approved))
if not msgs and not approved:
return {"summary": "Nothing new"}
for m in msgs:
snippet = gmail.users().messages().get(userId="me", id=m["id"]).execute()["snippet"]
f = ai.generate(f"Extract vendor, amount and due date (YYYY-MM-DD):\n{snippet}", json_schema=SCHEMA, max_output_tokens=80).json
sheets.values().append(spreadsheetId=SHEET_ID, range="AP!A:E", valueInputOption="USER_ENTERED", body={"values": [[f["vendor"], f["amount"], f["due"], "New"]]}).execute()
done.add(m["id"])
for i, (vendor, amount, due, *_) in approved:
v = qb("GET", "/query", params={"query": f"select * from Vendor where DisplayName = '{vendor}'"})["QueryResponse"]["Vendor"][0]
bill = qb("POST", "/bill", json={"VendorRef": {"value": v["Id"]}, "DueDate": due, "Line": [{"Amount": float(amount),
"DetailType": "AccountBasedExpenseLineDetail", "AccountBasedExpenseLineDetail": {"AccountRef": {"value": "7"}}}]})["Bill"]
sheets.values().update(spreadsheetId=SHEET_ID, range=f"AP!D{i}:E{i}", valueInputOption="RAW", body={"values": [["Done", bill["Id"]]]}).execute()
state.set("done", list(done)[-500:])
return {"logged": len(msgs), "billed": len(approved)}FAQ
Common questions
Which emails are read?
What if AI reads a figure wrong?
Do scanned paper invoices work?
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 rows in a billing sheet into QuickBooks invoices
Each new row in your billing sheet becomes a QuickBooks invoice, and the invoice number is written back into the row.
See how it worksAdd expenses from a sheet into QuickBooks
Expenses your team lists in a Google Sheet are added to QuickBooks within the hour and marked as uploaded.
See how it worksWelcome every new QuickBooks customer by email
Each customer you add to QuickBooks gets a welcome email from your Gmail, and is logged in a sheet so nobody is welcomed twice.
See how it worksKeep exploring
Set up “Log emailed supplier invoices in a sheet and create bills once approved” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.