Skip to content

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.

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

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

  1. Every 15 minutes, ClickRuntime checks your chosen OneDrive folder for new PDF invoices since the last check.

  2. It reads the text of each new invoice.

  3. AI picks out the supplier, the invoice date and the total.

  4. 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

RunsEvery 15 minutes
Pull totals from invoices saved to OneDrivetoday, 9:00Succeeded
Email · Invoice: Northwind Supplies $1,240.00Northwind Supplies · 2026-10-17 · $1,240.00 · INV-2291.pdf

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 OneDrive 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.
ai_invoice_field_extraction.pyexample
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?
Typically vendor name, invoice number, invoice date, due date, currency, subtotal, tax and total, plus line items if you ask for them. You can name the fields your finance system needs and they will be sent in that order.
Does it work on scanned invoices?
It reads PDFs, including many scanned ones, but accuracy depends on scan quality. A crisp scan usually works, while a skewed, faded or handwritten page may give wrong or missing fields. Treat the email as a first pass to check.
Will it enter the invoice into my accounting software?
As described, it emails the extracted fields and does not post to an accounting system. That keeps a person in the approval path. Writing to a specific accounting tool is a different automation to set up.
What permissions does it need?
read. 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 “Pull totals from invoices saved to OneDrive” from your assistant

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