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:meTurn 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 otherwiseFixing 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.