Every 15 minutes
Create PDF invoices from Airtable orders into Drive
When an order in Airtable is marked for invoicing, a PDF invoice is created, saved to Drive and linked on the record.
- Runs
- Every 15 minutes
- Apps
- Airtable, Google Drive
- AI
- Not needed
- Access
- Airtable read+write; Drive write
Send this to your assistant
Create a ClickRuntime automation: when an Airtable order is marked 'Invoice', create a PDF invoice with its line items, save it to my Drive 'Invoices' folder, and put the link on the order.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A small print studio takes orders by phone and email and tracks them in Airtable: customer, items, quantities and prices. When a job ships, someone copies the order into an invoice template, exports a PDF, saves it in the right folder and pastes the link back. It is ten minutes per order and easy to get a figure wrong.
Building the invoice straight from the Airtable record means the numbers on the PDF are exactly the numbers in the order, and the file is filed in Drive with a link the team can send to the customer.
What you get out of it
Invoices match the order
Line items, quantities and totals are taken from the record, so there is no retyping.
Filed in one place
Every invoice PDF is saved in your Invoices folder in Drive with a consistent name.
Link on the record
The order gets the PDF link and moves to Invoiced, so the team can see what has been billed.
Each order invoiced once
Only orders marked Invoice are picked up, and they move on once the PDF exists.
How it works
What happens, step by step
Every 15 minutes, ClickRuntime looks in your Airtable Orders table for orders marked Invoice.
It builds a PDF invoice from the customer details and line items on each order.
The PDF is saved to your Invoices folder in Drive.
The order gets the PDF link and moves to Invoiced, so it is not invoiced again.
Before it runs live
- Connect Airtable
- 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
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Airtable and Google Drive steps into one automation
Under the hood
The code that runs this automation
import io
from fpdf import FPDF
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from googleapiclient.http import MediaIoBaseUpload
from clickruntime import on_trigger, credentials, http, report_fetched
BASE_ID, FOLDER_ID = "appXXXXXXXXXXXXXX", "1FolderIdOfInvoices"
@on_trigger
def run(event):
api, headers = f"https://api.airtable.com/v0/{BASE_ID}/Orders", {"Authorization": f"Bearer {credentials.connection('airtable', 'work')}"}
orders = http.get(api, headers=headers, params={"filterByFormula": "{Status}='Invoice'"}).json()["records"]
report_fetched(len(orders))
if not orders:
return {"invoiced": 0}
drive = build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
for rec in orders:
f, pdf, total = rec["fields"], FPDF(), 0.0
pdf.add_page(); pdf.set_font("Helvetica", size=12)
pdf.cell(0, 10, f"Invoice {f.get('Order number')} - {f.get('Customer')}", new_x="LMARGIN", new_y="NEXT")
for line in (f.get("Line items") or "").splitlines():
desc, qty, price = [p.strip() for p in line.split(",")]
total += float(qty) * float(price)
pdf.cell(0, 8, f"{desc} x{qty} @ {float(price):.2f}", new_x="LMARGIN", new_y="NEXT")
pdf.cell(0, 10, f"Total: {total:.2f}")
file = drive.files().create(body={"name": f"Invoice {f.get('Order number')}.pdf", "parents": [FOLDER_ID]},
media_body=MediaIoBaseUpload(io.BytesIO(bytes(pdf.output())), mimetype="application/pdf"),
fields="webViewLink").execute()
http.patch(api, headers=headers, json={"records": [{"id": rec["id"], "fields": {
"Status": "Invoiced", "Invoice PDF": file["webViewLink"], "Total": total}}]}).raise_for_status()
return {"invoiced": len(orders)}FAQ
Common questions
What do the line items need to look like?
Can the invoice show my logo and bank details?
Does it email the invoice to the customer?
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
Keep an Airtable list of new files in a Drive folder
Every file added to a Drive folder is listed in Airtable with its name, type, owner and link.
See how it worksScreen CVs from a Drive folder into Airtable
Each CV dropped into your Drive folder is read, scored against the job, and saved as a candidate record in Airtable.
See how it worksWrite captions for Drive videos and track them in Airtable
Each video or photo you drop into a Drive folder gets a caption and hashtags and appears in your Airtable content table, ready to post.
See how it worksKeep exploring
Set up “Create PDF invoices from Airtable orders into Drive” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.