Gmail already has the tools: search operators like has:attachment filename:pdf find invoices, filters label or forward new ones, and Apps Script or Zapier save PDF attachments to Google Drive. All three fail at the same points: invoices behind download links, receipts in the email body, and matching invoices to payments. Here is each level with verified search strings and menu paths – and where an AI agent with read-only access takes over.
Where invoices hide in Gmail
Invoices arrive in six forms, and each automation covers only some of them:
- PDF attachment: the standard case, often next to terms and conditions or a promotional PDF.
- Download link: only a link to your customer account, often behind a login – no file in your mailbox. See Invoice only available as a download link?
- Receipt in the email body: app stores, subscriptions and ride-hailing apps often send HTML emails without attachments; the email is the receipt.
- Updates and Promotions tabs: with the Default inbox type, Gmail files automated confirmations, notifications, statements and reminders under Updates; vendors that also send newsletters often land in Promotions.
- Spam: invoices from new senders sometimes end up there, and Gmail permanently deletes Spam and Trash after 30 days.
- Several accounts: personal Gmail, Workspace, aliases and plus addresses such as name+invoices@. If you use “Check mail from other accounts”, note that Google is removing this POP fetching: no new users after the first quarter of 2026, existing users until January 2027 (Google Help). The alternative: collect invoices from any IMAP mailbox.
Level 1: Find invoices with Gmail search operators
Gmail search operators can be combined freely; Google lists them under Refine searches in Gmail. The most useful ones for invoices:
| Operator | What it does | Example |
|---|---|---|
has:attachment | only emails with attachments | has:attachment invoice |
filename: | attachments by file type or name | filename:pdf, filename:xml |
from: | sender | from:billing@example.com |
subject: | word in the subject line | subject:invoice |
" " | exact phrase | "your invoice" |
OR | match any of several criteria | invoice OR receipt |
- | exclude a term | invoice -quote |
( ) | group terms | subject:(invoice OR receipt) |
after: / before: | date range, written YYYY/MM/DD | after:2026/08/01 before:2026/09/01 |
newer_than: / older_than: | relative period in days (d), months (m) or years (y) | newer_than:3m |
label: | emails under a label | label:invoices |
category: | emails in an inbox category | category:updates, category:promotions |
in:anywhere | search everywhere, including Spam and Trash | in:anywhere invoice |
deliveredto: | delivered to a specific address | deliveredto:accounts@example.com |
Searches you can reuse every month:
- A month of PDF invoices:
has:attachment filename:pdf (invoice OR receipt OR Rechnung) after:2026/08/01 before:2026/09/01 - Invoice emails without attachments (links, body-only receipts):
subject:(invoice OR receipt) -has:attachment newer_than:1m - XML e-invoices such as Germany's XRechnung:
filename:xml newer_than:1y - Invoices in Promotions:
category:promotions (invoice OR receipt)
Normal search skips Spam and Trash; add in:anywhere or set “All Mail” in the search options to “Mail & Spam & Trash”. Skip amounts: Gmail reads a dot in a number as a decimal point, and vendors format amounts differently.
Where level 1 stops: search finds only what you look for; downloading, renaming, filing and opening portal links stay manual.
Level 2: Filters and labels for new invoices
A filter is a saved search with an action; Google says it can label, archive, delete, star or forward incoming mail. On a computer:
- Next to “Labels” on the left, click Create new label, for example “Invoices” (“Nest label under” puts it below “Accounting”).
- Click Show search options in the search box.
- Enter criteria: vendor addresses in “From”, joined with
OR, orinvoice OR receiptin “Has the words”. - Optionally click Search to check the matches.
- Click Create filter at the bottom of the search window.
- Choose the actions – apply the “Invoices” label, optionally Skip the Inbox or Forward it – and click Create filter.
Quicker from an existing invoice email: check its box, click More, then Filter messages like these. Filters live under Settings → See all settings → Filters and Blocked Addresses, where you can export and re-import them as XML (Google Help on filters).
Forwarding: verify first, then filter
To forward invoices, say to your accounting software's upload address, add it under Settings → See all settings → Forwarding and POP/IMAP → Add a forwarding address. Gmail sends a verification link there, and only after it's clicked can a filter use the address – for a tool's address, check how you'll reach that email. According to Google's forwarding help, forwarding filters only affect new messages, spam isn't forwarded, and each destination needs its own filter.
Where level 2 stops: filters sort but don't collect. Links stay links, missing invoices only surface in your invoice reconciliation workflow, and every new vendor needs a new rule.
Level 3: Save attachments to Google Drive automatically
Filters can't save to Google Drive; that takes an automation that reads Gmail and writes to Drive:
- Google Apps Script: a script in your Google account saves, say, the attachments of every email labeled “Invoices” to a Drive folder, run on a schedule by a time-driven trigger. It's free but capped: 6 minutes per run, 90 minutes of trigger runtime a day on personal accounts, 6 hours on Google Workspace (Apps Script quotas).
- No-code tools like Zapier or Make: Zapier offers templates such as “Save new Gmail attachments to Google Drive”, built on its “New Attachment” trigger – quicker than a script, but one more service gets access to your mailbox.
Where both stop:
- Files only: download links and body-only receipts never reach the folder.
- No checking: terms and conditions, quotes and delivery notes get saved too.
- Duplicates: a reminder with the same invoice attached creates a second file; soon there are ten files named
invoice.pdf. - No matching: the folder doesn't know which bank debit still lacks an invoice.
- Backlog and upkeep: “New Attachment” only fires for new attachments, and a renamed label or changed permission can silently break the chain.
Level 4: An AI agent with read-only access
An AI agent flips the direction: it starts from your bank transactions and looks for the invoice behind each undocumented payment – attachment, email body or link. How belege.ai does it with Gmail:
- Read-only Google sign-in: Gmail's “readonly” permission, no stored mailbox password; Google Workspace addresses work too. Setup steps are in our handbook (German).
- One search per open payment, built from sender, payment reference, amount, domain and a date window around the booking date, going back months if needed.
- Attachments, bodies and links: HTML receipts without a PDF, such as Apple's, are saved as PDF. If a link leads to a login page, the browser agent signs in to the vendor portal and downloads the invoice – for many portals, not all.
- Daily scan of new mail (the default for new mailboxes): AI reviews PDF attachments and imports invoices, receipts, credit notes and payment receipts, not quotes, order confirmations, delivery notes or terms and conditions. The first run starts from the month you pick during setup; links are left to the per-payment search.
- Duplicates and matching: identical files are caught across all sources, and the same invoice number, date, amount and currency trigger an AI check; duplicates are flagged, not deleted. Clear matches are assigned directly, otherwise AI compares candidates and checks that the amount is in the document.
- Questions in Telegram only when a case can't be finished alone – a paper receipt, a 2FA code, a genuinely unclear case.
Mailboxes you'd rather not connect can forward to your personal address (receipts by email); mail from other senders needs a one-time approval in Telegram. More on matching: match receipts to bank transactions.
The four levels compared
| Level | Effort | What's covered | What slips through |
|---|---|---|---|
| 1. Search operators | No setup, manual work every month | Whatever you search for, plus Spam and Trash via in:anywhere | Invoices you forget, links, bank matching |
| 2. Filters and labels | Set up once, extend for every new vendor | New invoices from known senders, sorted or forwarded | Older emails, new senders, links, spam, matching |
| 3. Apps Script, Zapier, Make | Setup plus maintenance, some technical skill | Attachments of new emails, saved to Google Drive | Links, body-only receipts, checks, duplicates, matching |
| 4. AI agent with read-only access | Connect mailbox and bank once, answer occasional questions | Attachments, email bodies and links for every open payment, duplicate checks, matching | Paper receipts, invoices never sent by email, portals where automated sign-in fails |
A handful of invoices a month? Levels 1 and 2 will do. Once invoices hide behind links and every debit needs a document, automation pays off.
Google Workspace specifics
Workspace accounts use the same operators and filters, with two differences:
- Admins control third-party apps: under Security → Access and data control → API controls in the Admin console, apps are marked Trusted, Limited, Specific Google data or Blocked, and Gmail's high-risk scopes – Google's list includes
gmail.readonly– can be restricted separately. If a tool won't connect, that may be why (Google Workspace Help). - Automatic forwarding can be off: it's on by default, but if an admin disables it under Apps → Google Workspace → Gmail → End User Access, the option disappears from your Gmail settings (Google Workspace Help).
For a shared address such as invoices@example.com, deliveredto: finds everything delivered there (see set up an invoice email address). To revoke a tool's access, open the linked apps in your Google Account and choose Access to your Google Account → See details → Remove access (Google Account Help) – worth doing in addition to disconnecting inside the tool.
Retention: what to keep and for how long
Gmail is a mailbox, not an archive: emails can be deleted at any time, Spam and Trash are emptied after 30 days, and when storage runs out (the 15 GB included with a Google Account are shared by Gmail, Drive and Photos), Google warns that sending and receiving can be affected. For businesses in Germany, the rules are fixed:
- Eight years for invoices: incoming invoices are accounting vouchers (Buchungsbelege) and, since 2025, are kept for eight years (Section 147(3) AO and Section 14b UStG, both in German). The clock starts at the end of the calendar year: an invoice from March 2026 can be deleted in early 2035 at the earliest, unless it's still needed for an open tax assessment.
- Six years for business emails that aren't vouchers, such as a price agreement; ten years for books and annual financial statements.
- Received format: electronic records must stay available, readable and machine-processable (Section 147(2) AO). Under the GoBD, Germany's rules for digital bookkeeping, electronic invoices stay electronic; printing them and deleting the file isn't enough.
- Email as envelope: an email that only says “invoice attached” is a mere means of transport under the GoBD; keep the attachment. If the receipt is the email body, save the email via More → Download message (an EML file).
- E-invoices: since 2025, every business in Germany must be able to receive them. The legally relevant part is the XML – the XRechnung file or the XML inside a ZUGFeRD PDF – so store it unchanged. A plain PDF invoice sent by email is not an e-invoice in this legal sense.
Elsewhere, rules differ – ask your accountant. For the handover itself, see month-end invoice handoff.
Common mistakes and a checklist
The traps that cost the most time:
- Searching only the inbox: Updates, Promotions and Spam slip through. If you move an invoice out of Spam, Google says that sender's future mail won't go there.
- Forwarding filters for old mail: they only act on new messages.
- Saving attachments only: links and body-only receipts go missing until your accountant asks.
- Searching by amount: 1,190.00, 1190.00 and 1.190,00 EUR are the same amount.
- Duplicates: reminders and re-sent invoices get filed twice – see how to catch duplicate invoices early.
Checklist
- List every address that receives invoices, aliases included.
- Write down a monthly search with
has:attachment, invoice terms and a date range. - Handle invoice emails without attachments separately.
- Check Updates, Promotions and Spam every month.
- Label invoices with filters and export the filters as XML.
- Archive invoices outside Gmail – in Germany for eight years.
- Check that every bank payment has a document.