Every 15 minutes
Pull totals from invoices saved to OneDrive
Each invoice PDF dropped in a folder becomes a one-line email with supplier, date and total.
- Runs
- Every 15 minutes
- Apps
- OneDrive
- AI
- Yes, uses the built-in AI allowance
- Access
- read
Send this to your assistant
Create a ClickRuntime automation: when an invoice PDF lands in OneDrive Invoices, extract the supplier, invoice date and total and email me one line per invoice.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
An accounts payable clerk at a 40-person firm has a OneDrive folder called Invoices Inbox where suppliers' PDFs land from email attachments, scans and shared links. Each one has to be opened, then the vendor name, invoice number, issue date, due date and total are retyped into the finance system. A typo in an amount or a missed due date means a late fee, a duplicate payment, or a supplier chasing for money they were owed weeks ago.
Every 15 minutes, OneDrive is checked for new PDFs in the folder. Each file is downloaded and read by ClickRuntime's built-in AI, which pulls out vendor, invoice number, dates, currency, tax and total, and an email listing those fields (with a link to the original file) is sent to whoever handles payables. A delta token remembers where the last check ended.
It suits small finance teams and bookkeepers who receive invoices in many layouts and have no OCR software. Month-end stops being a scramble to catch up on a backlog of unopened PDFs.
What you get out of it
Fewer keying mistakes in payments
Retyping totals and invoice numbers is where errors creep in. Pulling the fields straight from the document means the email shows what the supplier actually billed, so the clerk compares figures instead of typing them.
Due dates are seen on arrival
Because each invoice produces an email with its due date as soon as the file lands, a net-15 invoice does not sit unread for ten days and then trigger a late fee.
Duplicate invoices are easier to spot
Seeing vendor and invoice number in a short email makes it obvious when the same bill shows up twice, so a duplicate payment is stopped before the money leaves the account.
Suppliers with odd layouts still work
Invoices from a freelancer, a utility and a distributor look nothing alike. Reading the document with AI handles different layouts without building a template for each vendor. A short review step on the email is still faster than typing everything into the finance system from scratch.
Entry time drops sharply
A pile of 30 month-end invoices that took an afternoon to key in becomes a stack of summaries to check, which leaves time for the exceptions that need human judgment.
How it works
What happens, step by step
Every 15 minutes, ClickRuntime checks your chosen OneDrive folder for new PDF invoices since the last check.
It reads the text of each new invoice.
AI picks out the supplier, the invoice date and the total.
You get a one-line email per invoice, such as "Northwind Supplies · 2026-10-17 · $1,240.00 · INV-2291.pdf".
Before it runs live
- Connect OneDrive
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 OneDrive steps into one automation
Under the hood
The code that runs this automation
from io import BytesIO
from pypdf import PdfReader
from clickruntime import on_trigger, credentials, http, state, ai, notify, report_fetched
FOLDER = "Invoices"
@on_trigger
def run(event):
h = {"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}
url = state.get("delta_link") or f"https://graph.microsoft.com/v1.0/me/drive/root:/{FOLDER}:/delta"
pdfs = []
while url:
res = http.get(url, headers=h).json()
pdfs += [i for i in res["value"] if i.get("name", "").lower().endswith(".pdf") and "deleted" not in i]
url, delta = res.get("@odata.nextLink"), res.get("@odata.deltaLink")
report_fetched(len(pdfs))
if not pdfs:
state.set("delta_link", delta)
return {"summary": "Nothing new"}
for f in pdfs:
pdf = PdfReader(BytesIO(http.get(f"https://graph.microsoft.com/v1.0/me/drive/items/{f['id']}/content", headers=h).content))
text = "\n".join(p.extract_text() or "" for p in pdf.pages[:3])[:8000]
x = ai.generate(text, system="Extract invoice fields.", max_output_tokens=120, json_schema={"type": "object", "properties": {
"supplier": {"type": "string"}, "date": {"type": "string"}, "total": {"type": "string"}}}).json
notify.email_me(f"Invoice: {x['supplier']} {x['total']}", f"{x['supplier']} · {x['date']} · {x['total']} · {f['name']}")
state.set("delta_link", delta)
return {"invoices": len(pdfs)}FAQ
Common questions
What invoice fields are extracted?
Does it work on scanned invoices?
Will it enter the invoice into my accounting software?
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
Get new PDFs in a folder summarised
Each PDF added to a folder reaches you as a short summary instead of a file to open.
See how it worksHear when a file lands in a OneDrive folder
You get an email each time a new file appears in the folder you're watching.
See how it worksSort a OneDrive folder by file type
New files in your catch-all folder move into PDFs, Images or Other subfolders.
See how it worksKeep exploring
Set up “Pull totals from invoices saved to OneDrive” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.