Paperwork that files itself

File invoices from your inbox automatically with n8n

The most copied document workflow there is, and the most boring. An invoice arrives, it gets filed where it belongs and logged in a sheet, and nobody has to remember anything.

Build time
An afternoon
Difficulty
Beginner
Template
7 nodes

What you need before you start

  • An n8n instance.
  • A Gmail or Outlook account, connected as an n8n credential.
  • Google Drive and Google Sheets, or their Microsoft equivalents.
  • Ten minutes deciding your folder naming before you build anything.

There is nothing clever in this one. That is why it is the most copied document workflow in n8n’s public library and why it is the first thing worth building.

An invoice arrives by email. It ends up in a folder named after the month, renamed so you can read it in a list, with a row in a spreadsheet giving the supplier, the date and the total. No decisions, no judgement, nothing that needs a human at three in the morning.

Decide the folder names first

Ten minutes here saves an evening later, and almost everybody skips it.

Pick one structure and never change it:

Invoices/
  2026-07/
    2026-07-14 Screwfix 84.20.pdf
    2026-07-22 British Gas 219.66.pdf
  2026-08/

Year first, month second, zero-padded. That sorts correctly in every file browser ever written, which July 2026 does not. The filename carries the date, the supplier and the amount, so you can find a payment by scanning a list rather than opening eleven PDFs.

If your accountant already has a structure they want, use theirs. The only wrong answer is inventing a new one halfway through the year.

The build, seven nodes

1. Gmail Trigger. Poll every fifteen minutes. Under filters, set the search to Gmail’s own query syntax:

has:attachment filename:pdf -from:me

Turn on Download Attachments. Without it you get the message and not the file, which produces a workflow that runs perfectly and files nothing.

Outlook users: the Microsoft Outlook trigger works the same way, with hasAttachments eq true as the filter instead.

2. Filter, called Looks Like An Invoice. Not every PDF is an invoice. A reasonable first pass is the subject or filename containing any of invoice, receipt, bill, statement, or the sender being on a list of suppliers you already know.

Get this wrong in the generous direction. A misfiled delivery note is a small annoyance. A missed invoice is a real one.

3. Extract from File. Operation: Extract from PDF. This pulls the text layer out of the document, which is what almost every emailed invoice has.

What it will not do is read a scanned invoice, because a scan is a picture and there is no text layer to extract. If a supplier sends photographed paper, that one needs the OCR build instead. Add an IF node checking that the extracted text is longer than about fifty characters, and route the empty ones to a folder called needs-a-look.

4. Information Extractor. Give it the extracted text, ask for four fields:

supplier   the company being paid, as printed
date       the invoice date, as YYYY-MM-DD
total      the gross amount, numbers only
currency   GBP unless stated otherwise

Fixing the date format in the prompt is worth doing. UK invoices are inconsistent about it and a mix of 14/07/2026 and Jul 14 2026 in one column will ruin every sum you try to write later.

5. Code node, called Filename. Assemble the new name and the folder path:

const d = $json.date || new Date().toISOString().slice(0, 10);
const month = d.slice(0, 7);
const supplier = ($json.supplier || 'unknown').replace(/[\/\\:*?"<>|]/g, '').trim();
const total = Number($json.total || 0).toFixed(2);
return [{ json: { ...$json, month, filename: `${d} ${supplier} ${total}.pdf` } }];

That character strip is not decoration. A supplier called Smith & Sons Plumbing / Heating will otherwise create a folder called Heating inside a folder called Smith & Sons Plumbing, and you will spend twenty minutes working out why.

6. Google Drive, Upload. Into Invoices/{{ $json.month }}, with the new filename. Turn on the option to create the folder if it is missing, or the first invoice of every month fails.

7. Google Sheets, Append. Date, supplier, total, currency, the sender’s address, a link to the Drive file, and today’s date as filed_on. The Drive link is the column you will use most.

Check it on a fortnight of real post

Point it at your actual inbox, let it run over messages you already have, and then look at the folder rather than the execution log.

Three things to check. The totals should match the PDFs, spot-checked on five. The dates should all be in the same format. And the supplier column should be readable names rather than ACCOUNTS@ or noreply.

That last one is the usual disappointment. Extraction from a badly laid out invoice sometimes grabs the wrong line, and the fix is a short list of corrections in the Code node mapping what it finds to what you call them. Six entries covers most small businesses permanently.

Keep the original email

The tempting next step is to have the workflow archive or delete the message once it is filed. Do not, at least not for the first few months.

The email is your fallback when the extraction was wrong, and it is the only way to tell a supplier you never received something. Label it instead. Gmail will let the workflow add filed as a label, which gives you the tidy inbox without throwing anything away, and means a botched run is recoverable rather than final.

What it does not cover

Portal invoices. Utilities, telecoms and increasingly banks send an email saying a document is ready and keep the document behind a login. Nothing in this workflow can get those, and no automation can without your password. The realistic answer is a monthly reminder listing the four suppliers who do this, so it is a ten-minute job on the first of the month rather than a discovery in February.

Other inboxes. It watches one mailbox. If invoices land at accounts@, hello@ and somebody’s personal address, this covers a third of your paperwork while looking like it covers all of it. Forward everything to one address, or run the trigger three times.

Anything about tax. It files and logs. It does not categorise for VAT, decide what is deductible or check that a bill is right. Tidier inputs make your accountant faster, which is worth real money. Replacing their judgement with a model’s is how a wrong number reaches a return.

Published 28 August 2026. Written by the people who run this sort of thing for clients, on n8n, including our own lead pipeline.

Next in paperwork that files itself: Reading a photo or PDF into structured data. Or go back to all 4 in this category.

Questions about this build

How long do I have to keep invoices in the UK?

If you are self-employed, at least five years after the 31 January submission deadline of the relevant tax year. If you run a limited company, six years from the end of the financial year the records relate to, and longer where a transaction spans more than one accounting period or covers something expected to last more than six years, like machinery. Build the folder structure with those numbers in mind, because deleting a year too early is a problem and keeping one too long is not.

Does HMRC accept digital copies of invoices?

Yes. What HMRC requires is complete and legible records, not paper ones, and Making Tax Digital pushes in the direction of digital record keeping generally. From April 2026 it applies to qualifying income above £50,000, dropping to £30,000 in April 2027 and £20,000 in April 2028. A clear scan or PDF filed somewhere you can find it satisfies the requirement better than a shoebox does.

What about invoices that arrive as a link to a portal?

This build cannot fetch those and you should not pretend otherwise. Utilities and telecoms are the usual culprits: the email says your bill is ready and the document lives behind a login. The honest fix is a monthly reminder listing the portal suppliers you have, so somebody downloads them in one sitting rather than discovering the gap at year end.

Should the workflow rename the files?

Yes, and this is the part people skip. A folder full of invoice.pdf, invoice(1).pdf and scan0043.pdf is barely better than the inbox. Rename to date, supplier and amount, and the folder becomes searchable without opening anything.

Will it catch invoices sent to a different address?

Only the mailbox you point it at. If invoices arrive at three addresses, either forward them all to one or run three copies of the trigger. Assuming one inbox sees everything is the most common way this workflow ends up looking like it works while missing a third of the paperwork.

The next step

Stop losing leads.Let's fix it this week.

Tell us what keeps slipping and we'll scope something around it. You'll be talking to Max, who runs the work, not a sales team. Most clients are live within 48–72 hours of that first conversation.

30-day rolling retainers. No lock-in. Cancel anytime.