Guide

Extract invoice data from PDF attachments into Google Sheets

The sample invoice PDF the workflow reads, with text such as Harbour Supplies Ltd, HS-2026-0417, 2026-11-12.
The PDF it reads. Open the sample invoice PDF. It has a text layer, which is what makes it readable.

PDFops reads the text, a model fills the columns

/api/extract-text, once per PDF. Done by the n8n workflow below.

RowVendorTotal+6 more
2Harbour Supplies Ltd116.60…
The row it adds to the sheet

Supplier invoices arrive as PDF attachments and end up re-typed into a spreadsheet. PDFops reads the text stored inside a PDF, and a chat model of your choice turns that text into invoice fields. This page offers one n8n workflow as a download. It reads only PDFs that have a text layer: there is no OCR, so a scanned invoice comes back with no text and is recorded as Needs OCR. Nothing in the workflow compares the extracted fields with the page, so every row needs a read against its PDF before it is paid.

What you get

Each invoice PDF in a labelled Gmail message becomes one row in a Google Sheet: vendor, invoice number, date, currency, total, tax and line items, plus a status that says whether the numbers add up. See the sample invoice PDF.

Set it up

  1. Check that your n8n can run it. The workflow uses the Extract Text operation of the PDFops node, which arrived in n8n-nodes-pdfops 0.5.0. n8n's community node registry (api.n8n.io/api/community-nodes) listed 0.4.0 when this page was written, on 2026-11-28, and that version has no Extract Text, so n8n Cloud cannot run the workflow until the registry lists 0.5.0 or newer. A self-hosted n8n can install the current release from npm. The workflow also needs Gmail, Google Sheets, Slack and chat model credentials.
  2. Get a free key and connect PDFops. Create a free API key, install the n8n-nodes-pdfops community node, and paste the key into the PDFops credential on the Extract PDF Text node.
  3. Label the invoice emails in Gmail. Create a Gmail label named invoices and a filter that applies it to your supplier mail, or edit the search in the Gmail Trigger. The trigger reads only messages that carry the label and have an attachment, and only PDF attachments are processed.
  4. Add the header row to the sheet. Put these headers in row 1 of the tab, in any order: Status, Source id, Reason, Vendor, Invoice number, Invoice date, Currency, Total, Tax, Line items, Line item count, Pages read, Source file, Sender, Message link, Processed at. The workflow stops with an error when a required column is missing, and skips any PDF whose Source id is already in the sheet. It reads the whole sheet on every run, so archive old rows when it grows large.
  5. Test on a scratch sheet, and leave it inactive. Open the Set Run Options node. Point spreadsheetUrl at a scratch sheet, set sheetName and set notifyChannel to a test Slack channel. Keep the workflow inactive, so the Gmail Trigger never starts on its own, until the rows are right. Paste the id of one labelled test email into Set Message Id and run Reprocess One Email by hand from the editor. A manual reprocess skips the Source id check and appends a new row, so delete an old row if you do not want both.
  6. Read every row against its PDF. Open the appended row beside the PDF it came from. Extracted means the required fields are present and the amounts add up within amountTolerance, which is 0.02 by default. It does not mean the values are right: the model can misread a field, and nothing checks any value against the page. Set amountTolerance to 0 to require exact sums.
  7. Set an error workflow, then activate. In n8n go to Settings, then Error workflow, and pick a workflow that alerts you, so a failed run is never silent. Then put your real spreadsheetUrl and notifyChannel in Set Run Options and activate the workflow. From then on every labelled email with a PDF becomes a row.

What lands in the sheet

Each PDF becomes one POST call to /api/extract-text (endpoint reference). The call returns the text of each page, and the chat model fills the fields from that text. The table shows eight of the sheet's columns for the sample invoice, and says which values appear in the PDF's own text; the setup steps list every column. The sample row shows what a correct read looks like, and a model can still get a real invoice wrong.

Sheet columnExample valueFound in the PDF text?
VendorHarbour Supplies LtdIn the sample PDF text
Total116.60In the sample PDF text
Invoice numberHS-2026-0417In the sample PDF text
Invoice date2026-11-12In the sample PDF text
CurrencyEURIn the sample PDF text
Tax10.60In the sample PDF text
Line item count2Set by the workflow
StatusExtractedSet by the workflow

Workflow

n8n

Download the n8n workflow JSON: Extract invoice data from PDF attachments to Google Sheets with an AI step and checks. It is not in n8n's template gallery, so import the file into your own n8n. It uses the n8n-nodes-pdfops community node.

Steps: Gmail (New email with the invoices label and a PDF attached), then Google Sheets (Read the sheet, check its header, skip PDFs already in it), then PDFops (Extract Text from each PDF), then OpenAI (A chat model fills the invoice fields from that text), then n8n (Set a status: Extracted, Check, Needs OCR or Error), then Google Sheets (Append one row per PDF), then Slack (Post every row that is not Extracted).

Before you run it. The Gmail Trigger checks Gmail every minute for mail with the invoices label and a PDF attached, and the workflow then sends each PDF to PDFops, sends its text to your chat model provider, appends a row to the sheet in Set Run Options and posts a Slack message for every row that is not Extracted. Before the first run, set spreadsheetUrl to a scratch sheet and notifyChannel to a test channel, label two or three test emails, and keep the workflow inactive. Run Reprocess One Email by hand from the editor with one message id in Set Message Id, read the row it appends, and only then activate the workflow. If a run stops midway, the Gmail Trigger has already moved past the emails it had not recorded, so they must be reprocessed by hand. Nothing in the workflow compares an extracted value with the PDF: read every row against its PDF before you pay or book it.

Needs a paid plan. n8n has no free Cloud plan (n8n.io/pricing, read 2026-11-27). The workflow needs the n8n-nodes-pdfops community node at version 0.5.0 or newer, which a self-hosted n8n can install from npm, and a free PDFops key. Its AI step calls a chat model that you supply, and model providers usually bill by use. It also needs Gmail, Google Sheets and Slack accounts.

Get a free PDFops key for n8n

Frequently asked

Does it read scanned invoices?

No. PDFops has no OCR. A scanned page is a picture with no text stored in it, so the call returns no text for it. A PDF with no text on any page is recorded as Needs OCR: its row is still appended to the sheet and announced in Slack.

How accurate is the extraction?

That is not measured here. A chat model reads the text and fills the fields, and nothing in the workflow compares a value with the document. Hidden or unusual text in a PDF can also produce wrong values. The status only tells you whether the required fields are present and the amounts add up, so read every row against its PDF before paying.

What do the statuses mean?

Extracted: vendor, invoice number, a real date, currency and total are present, and the line amounts plus tax and shipping and fees minus discount equal the total within amountTolerance. Check: a field is missing, the amounts do not add up, some pages had no text, the text was cut, or fewer pages were read than the document has; the Reason column says which. Needs OCR: no page has text. Error: the PDF could not be read or the model step failed.

Can I run it on n8n Cloud?

Not yet. The workflow needs Extract Text from n8n-nodes-pdfops 0.5.0 or newer, and n8n's community node registry listed 0.4.0 on 2026-11-28, which has no Extract Text. A self-hosted n8n can install the current node from npm.

Is this workflow in the n8n template gallery?

No. It is a downloadable workflow file on this page, so there is no n8n gallery page for it. Download the JSON and import it into your own n8n.

Where does my data go?

Each PDF is sent to PDFops, and its extracted text is sent to the chat model provider you choose. The workflow uses an OpenAI model by default and any chat model n8n supports can replace it. The rows go to your Google Sheet, and Slack gets a message for each row that is not Extracted.

What happens if a run fails halfway?

The Gmail Trigger has already moved past those emails, so the ones not yet recorded are not picked up again. Paste each message id into Set Message Id and run Reprocess One Email by hand. Every Error and Check row carries a link to its email. The append step is not retried, because a retried append can write a row twice.

Does it run on a free plan?

n8n has no free Cloud plan. A self-hosted n8n has no licence fee and runs the workflow with a free PDFops key. You supply the chat model, whose provider usually bills by use, and the Gmail, Google Sheets and Slack accounts.

Try it

Get a free API key, then open a workflow above. You can also read the extract-text reference first.