This repository contains an n8n workflow that automatically:
- Watches a Gmail inbox for new emails with invoice PDF, PNG, jPG attachments
- Sends each invoice to the ParserData API
- Normalizes the response into one item per invoice line item
- Appends each line item as a new row into a Google Sheet
It's a complete “Email → Structured data in Sheets” pipeline for invoices.
- Official workflow page: https://parserdata.com/integrations/n8n/email-invoice-extractor
- n8n integration hub: https://parserdata.com/integrations/n8n
- API reference: https://parserdata.com/parserdata-api
- Pricing: https://parserdata.com/pricing
Workflow name: Parserdata - Email to Google Sheets (Invoices)
Nodes:
- Gmail Trigger: polls Gmail for new messages and downloads attachments
- HTTP Request (Parserdata Extract): sends the invoice PDF to Parserdata
- Code in JavaScript: expands Parserdata's response into one item per line item
- Google Sheets – Append Row: writes each line to a Google Sheet
The workflow JSON in this repo is ready to import into n8n. All credentials and IDs you can configure in your own instance.
To run this example you need:
- An n8n instance (self-hosted or cloud)
- A Parserdata account and an API key
- A Google account with:
- Gmail enabled
- Access to the Google Sheet where data will be written
- At least one invoice you can email as a test
Invoice example:
-
Create a new Google Sheet.
-
In the first row, add these column headers (one per column, left to right):
invoice_numberinvoice_datedue_datesupplier_namecustomer_nameskuitem_descriptionquantityunit_pricetax_amounttotal_amount
-
Copy the Spreadsheet ID from the URL.
It looks like:https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit#gid=0
You’ll pasteSPREADSHEET_IDinto the workflow later.
-
Download the
workflow.jsonfile from this repository. -
In n8n, go to Workflows → Import from File.
-
Select
workflow.jsonand import. -
Open the imported workflow and you'll see the 4 nodes:
- Gmail Trigger
- HTTP Request (Parserdata Extract)
- Code in JavaScript
- Google Sheets - Append Row
After importing, you must connect your own credentials and IDs.
- Open Gmail Trigger node.
- Select or create a Gmail OAuth2 credential.
- Make sure Download Attachments is enabled.
- Optionally set filters (labels, from addresses, subject, etc.) so only invoice emails are processed.
The workflow assumes the first attachment is the invoice and exposes it as attachment_0 for the Parserdata node.
Node: HTTP Request (Parserdata Extract)
This node:
- Sends a
POSTrequest tohttps://api.parserdata.com/v1/extract - Uses HTTP Header Auth (configured as n8n credentials)
- Uploads the invoice as
file - Sends a detailed prompt defining the JSON structure
Steps:
- In n8n, create an HTTP Header Auth credential for Parserdata:
- Header name: according to Parserdata docs (for example
Authorization) - Header value: something like
Bearer YOUR_PARSERDATA_API_KEY
- Header name: according to Parserdata docs (for example
- In the HTTP Request node, pick that credential in Authentication → Generic Credential Type → HTTP Header Auth.
- Keep the Content Type as
multipart-form-data. - Confirm the file field is configured as:
- Parameter type:
Form-Data (Binary) - Name:
file - Input Data Field Name:
attachment_0
- Parameter type:
The prompt already tells Parserdata which fields to extract and how to structure the response.
Node: Code in JavaScript
This node:
- Takes the Parserdata response
- Reads
result(the header-level data) - Iterates through
result.line_items - Returns one n8n item per line item, duplicating invoice-level fields on each item
You generally don't need to change this unless you want to add/remove fields.
Key mapping:
- Invoice-level fields:
invoice_numberinvoice_datedue_datesupplier_namecustomer_namenet_amounttax_amounttotal_amount
- Line-level fields:
skuitem_descriptionquantityunit_priceline_total
Node: Google Sheets - Append Row
This node appends each line item as a row.
Configuration steps:
-
Select or create a Google Sheets OAuth2 credential.
-
In Spreadsheet, use your actual Spreadsheet ID (the one from the URL).
-
Use the right sheet (for example
Sheet1/gid=0). -
The fields in the workflow are already mapped:
invoice_number→={{ $json.invoice_number }}invoice_date→={{ $json.invoice_date }}payment_due_date→={{ $json.due_date }}supplier_name→={{ $json.supplier_name }}customer_name→={{ $json.customer_name }}sku→={{ $json.sku }}item_description→={{ $json.item_description }}quantity→={{ $json.quantity }}unit_price→={{ $json.unit_price }}tax_amount→={{ $json.tax_amount }}total_amount→={{ $json.total_amount }}
You can customize the columns and mappings as needed.
- Activate the workflow in n8n.
- Send an email to the watched Gmail address with an invoice attached.
- Wait for the poll interval (or click Execute Workflow manually for a test).
- Open the Google Sheet:
- You should see one row per line item from the invoice.
- Invoice-level fields will repeat for each row.
If nothing appears, check:
- Execution logs in n8n
- That the email has at least one invoice attachment
- That credentials for Gmail, Parserdata, and Google Sheets are all connected
- Filter Gmail by label (e.g. only process emails in
Invoices). - Change the Parserdata prompt to extract additional fields.
- Add a Slack or email notification for new invoices above a threshold amount.
If you run into issues:
- Open a GitHub issue in this repository, or
- Reach out via the ParserData support email: support@parserdata.com.
Happy automating!
MIT


