Auto-save invoice PDFs to Google Drive from email and apps
How a workflow spots invoice PDFs in email and apps, names them by date, vendor and amount, and files them in one Google Drive folder. Never pays or deletes.
Every invoice PDF can land in one Google Drive folder with nobody downloading or uploading anything. A small workflow watches the inbox for PDFs that pass four tests, pulls invoices from the SaaS tools that expose them, renames each to date, vendor and amount, and uploads it into one folder through the Drive API. It skips duplicates. It files, never pays, never deletes. I'm building this for a team lead at Chimpy now, September 2026.
What a team lead at Chimpy asked for
Chimpy is Europe's largest powerbank rental service, run from Zürich since 2013. The team lead I work with there runs on Google Workspace and Slack, and gets invoices from two directions: vendors email them, and SaaS tools generate them behind a login. The brief was one sentence: "I need these PDFs automatically detected and uploaded into a specific Google Drive folder, without me manually downloading or uploading anything."
Here's what that replaces. Open the email, download the attachment, rename it, open Drive, find the folder, upload. Three minutes if nothing goes wrong. Once a month, the same again across five or six SaaS billing pages. And at month end the bookkeeper asks where the June invoice from the hosting provider went, and you go looking.
It's one of four workflows I'm building for the same person, written up in the Chimpy case study, and the one I'd build first. I was a plumber before I built workflows, and this is the plant-room job: label the pipes properly once and nobody calls you at midnight.
The four tests a PDF passes before it's filed
The hard part isn't the upload. It's deciding what counts as an invoice. Every email with a PDF is a candidate, and most of them are contracts, brochures, delivery notes and someone's CV. So each PDF passes four tests, in this order, and each test is cheap.
1. The sender. The workflow keeps an allowlist of billing addresses: the accounts address at each vendor, the no-reply address each SaaS tool sends from. A known sender goes on to the next test. An unknown sender goes to a "check me" folder with a one-line note in Slack. The allowlist grows as you approve senders, so it's strict in week one and quiet by month three.
2. The subject line. Chimpy operates in Switzerland, the Netherlands and Germany, so the word list can't be English only. Invoice, Rechnung, facture, fattura, factuur, faktura. Receipt, Beleg, Quittung, reçu. "Your invoice is ready" and "Ihre Rechnung" both pass. "Newsletter" does not.
3. The PDF text. The workflow opens the attachment and reads the text layer, looking for the same words, an invoice number and the vendor's name. A scanned PDF with no text layer fails here and goes to "check me", because I'd rather a person look at it than guess.
4. An amount and a date. An invoice has a total and a date. If the text has neither, it's a contract or a brochure, and it's not filed.
Pass all four and the file is renamed and uploaded. Fail one and a human sees it. That's the whole decision.
There's no AI in those four tests, and that's deliberate: rules first, AI second. Rules are free, deterministic, and I can write a test for each one. A model gets asked only about the PDFs that pass but are ambiguous on the details: which of three amounts on the page is the total, what the date is when it's written "31. August 2026", what the vendor is called when the sender is a payment processor. I use Claude for that step. It reads and extracts. It never decides whether to file.
Email is the easy half. The SaaS tools are the honest half
The brief said "various SaaS tools", and this is where I have to be straight with you. There are three kinds, and only two can be automated.
The first kind emails you the invoice as a PDF attachment every month. Those run through the same four tests. Nothing to build.
The second kind has a billing page and either an API or an export. For those the workflow runs a scheduled pull: sign in with an API key, list invoices since the last run, download each PDF, hand it to the same rename-and-upload path. Once a day is plenty. Some tools email a link instead of a file. If the link is a direct PDF, the workflow fetches it. If it needs a login, it drops into the third kind.
The third kind only shows a billing page behind a login, with no API and no export. Those stay a monthly manual download. I say so up front. The alternative is a scraper that logs in and clicks around, which breaks the first time the vendor redesigns the page and often breaks their terms of use. Instead I put a one-page list in the same Drive folder: tool, billing URL, the day of the month the invoice appears. Five minutes on the first of the month, with a checklist, instead of a hunt.
If you're choosing which automations to build first, this post walks through the order.
How the upload works, and how the file gets its name
Two facts about the Drive API shape the whole build.
First, a file goes into a folder by setting the folder's ID in the parents field. Leave parents empty and the file lands in the root of My Drive, which is how invoices get lost. And a file can only have one parent folder: specifying multiple parents isn't supported. So there's one invoices folder, and if you want a subfolder per year, the year folder is the one parent.
Second, Google offers three upload types. A simple upload sends a file of 5 MB or less with no metadata. A multipart upload sends a file of 5 MB or less together with its metadata in one request. A resumable upload is for files larger than 5 MB, or for a poor connection. Invoices are small and need a name and a parent, so this build uses multipart, with resumable as the fallback for the rare oversized scan.
The name is the part the bookkeeper cares about. The convention is date, vendor, amount, in that order, so the folder sorts itself by date. For example: 2026-08-31_slack_1240.00-chf.pdf. The date is the invoice date, not the day the email arrived. The vendor is lowercase, one word where possible. The amount carries its currency. Named like this, "where's the August Slack invoice" stops being a question anyone asks.
Duplicates happen more than you'd think. Vendors send the invoice, then a reminder with the same PDF. The daily SaaS pull overlaps with last week's. So the workflow keeps a small ledger: a hash of every PDF it uploads, plus the vendor and invoice number. Same hash again, skip it. Same vendor and invoice number but a different hash, which is what a corrected invoice looks like, and it files the new one with -v2 on the end. It never overwrites.
It files. It never pays and never deletes
This is the rule I'd refuse to build without.
The workflow has no access to a bank, a card, or a payments tool. Not because that would be hard to add. Because fake-invoice phishing exists: an email that looks exactly like your vendor's monthly invoice, with the IBAN changed. If the workflow could pay, the phishing email would only need to pass four tests to get paid. So it can't pay. It files, and a person approves.
It never deletes either. It doesn't archive the email, doesn't move files out of the folder, and its Drive access is scoped to that one folder. The worst thing it can do is file a PDF that isn't an invoice, which a person notices and fixes in ten seconds.
Here's what AI cannot do in this build. It can't tell you whether an invoice is legitimate. It can't tell that the bank details changed since last month. It can't tell whether you actually ordered the thing, or whether you already paid it. A model reading a PDF is a reader, not an auditor. Approval stays with a person.
Polling on a schedule, or Gmail push
There are two ways for the workflow to notice a new email.
Push means Gmail tells you: you call the API's watch method on the mailbox, notifications arrive through Cloud Pub/Sub with a history ID, and you fetch what changed. It's fast, and it has to be renewed. Google's guide says you must call watch at least once every 7 days or you stop receiving updates, and recommends calling it daily.
Polling means the workflow wakes up on a schedule, say every 30 minutes, searches the inbox for messages with PDF attachments since the last run, and processes what it finds. Slower. Also boring, which is what you want here. The same guide says that for user-owned devices the poll-based sync approach is still the recommended one.
For an invoice folder I poll. Nobody needs an invoice filed within a second, and a daily watch renewal is one more thing that can silently lapse, after which nobody notices for a fortnight. I made the same call for the twice-daily digest.
What it's worth, and what to do this week
Here's the estimate, and it stays an estimate until it has been measured over 30 days in use. Say you get 40 invoices a month. Say each one costs 3 minutes to find, download, rename and upload. 40 × 3 is 120 minutes, which is 2 hours a month, or about half an hour a week for one person. The month-end hunt adds more, but I'll only claim what I can count.
Half an hour a week isn't the reason to build it. The reason is that the folder is complete, named consistently and shared, so nobody hunts and the bookkeeper stops asking.
Here's what to do this week, before anyone builds anything:
- Make the one folder in Drive and share it with your bookkeeper. One folder, because the API only allows one parent anyway.
- Open last month's invoices and write down every sender address. That's your allowlist on day one.
- Sort your SaaS tools into the three piles: emails a PDF, has an API or export, login only. The third pile is your monthly checklist.
- Pick the naming convention and rename last month's files by hand, once, so the folder is consistent from the first day.
Then decide whether you build it yourself or I do. With me it's a fixed-price build plus a monthly retainer to run and maintain it, and what that looks like is on the implementation page. If you'd rather talk first, book a growth call. It's free, and I'll tell you if it isn't worth building. The Chimpy version is being built now, September 2026, and after a month in use I'll replace the estimate above with measured numbers.
Questions people ask
Can Gmail save invoice attachments to Google Drive on its own?
Not without a workflow. Gmail has no built-in rule that files attachments into Drive. A small workflow using the Gmail API and the Drive API can: it finds messages with PDF attachments, tests whether each one is an invoice, renames it, and creates it inside one folder by putting that folder's ID in the parents field (source: Google's Drive folder guide).
How does the workflow know a PDF is an invoice and not a brochure?
Four tests, in order: the sender is on an allowlist, the subject contains an invoice word in one of several languages, the PDF text contains the same words plus an invoice number, and the document has an amount and a date. Fail one and it goes to a check-me folder for a person. A model is only asked about ambiguous details, never whether to file.
What about SaaS tools that never email an invoice?
Sort them into three piles. Tools that email a PDF need nothing built. Tools with a billing API or an export get a scheduled daily pull. Tools that only show invoices behind a login with no API stay a monthly manual download, listed on a one-page checklist with the URL and the day of the month. I don't build scrapers against login pages; they break and often breach the terms of use.
Is there a file size limit when uploading invoices through the Drive API?
Google's Drive API upload guide (source) describes three upload types: simple and multipart uploads for files of 5 MB or less, and resumable uploads for files larger than 5 MB or for unreliable connections. Invoices are almost always small and need a name and a parent folder, so multipart is the normal path and resumable is the fallback for an oversized scan.
Is it safe to let an automation handle my invoices?
It is if the automation only files. Mine has no access to a bank, a card or a payments tool, never deletes an email or a file, and its Drive access is scoped to one folder. That matters because fake-invoice phishing exists: an email that copies your vendor's invoice with a changed IBAN. A workflow that could pay would only need to be fooled once. Approval stays with a person.
Sources
- 1.Google Drive API: Upload file data · Simple and multipart uploads for files of 5 MB or less; resumable for files larger than 5 MB or unreliable connections
- 2.Google Drive API: Create and populate folders · The folder ID goes in the parents field; a file can only have one parent folder; no parent means the root of My Drive
- 3.Gmail API: Push notifications · watch must be called at least once every 7 days, daily recommended; polling still recommended for user-owned devices; one event per second per user
- 4.Chimpy: About us · Europe's largest powerbank rental service, since 2013; Switzerland, Netherlands and Germany

Written by Ivar André Knutsen
I build and run AI systems, internal tools and workflow automation. You work directly with me from the first conversation through implementation and support. About Ivar
Want this looked at in your business?
We look at where you want the business to go, what is slowing you down and where AI could make a useful difference. You get a clear recommendation: a tool to try, a focused automation, a broader system or a closer look at the process. Any build is scoped and quoted before work starts. Free, no obligation.
Single automations are quoted on the call: a setup fee plus a monthly retainer to run them. Full systems start at $4,500, fixed scope, fixed price.
Book a free 30-minute call