Intermediate~20 min setupEmail & ProductivityVerified April 2026
Gmail logo
Google Sheets logo

How to Log Invoice Receipts from Gmail to Google Sheets with N8n

Automatically extract invoice details from Gmail attachments or emails and log them to a Google Sheets financial tracking spreadsheet.

Steps and UI details are based on platform versions at time of writing — check each platform for the latest interface.

Best for

Teams that receive invoices as PDF attachments and need custom parsing logic for multiple vendor formats.

Not ideal for

Simple invoice workflows where emails contain structured data that doesn't require PDF extraction or custom parsing.

Sync type

polling

Use case type

import

Real-World Example

💡

A 25-person marketing agency receives 40-60 vendor invoices per month as PDF attachments from different suppliers — hosting providers, design tools, contractor payments. Before automation, the finance manager spent 3 hours weekly manually entering invoice data into their expense tracking spreadsheet. Now invoices are logged automatically within 5 minutes of arrival, and the finance team only reviews the data for accuracy.

What Will This Cost?

Drag the slider to your expected monthly volume.

/mo
505005K50K

Each platform counts differently — Zapier: 1 task per trigger. Make: 1 operation per module per record. n8n: 1 execution per run.

Prices shown for annual billing. Based on published pricing as of April 2026.

Estimated ROI

1000

min saved/mo

$583

labor value/mo

Free

no platform cost

Based on ~2 min manual effort per operation at $35/hr fully loaded labor cost.

Implementation

Skip the setup

Import this workflow directly into n8n

Copy the pre-built n8n blueprint and paste it straight into n8n. All modules, filters, and field mappings are already configured — you just need to connect your accounts.

Before You Start

Make sure you have everything ready.

Gmail account with invoice emails or ability to receive test invoices
Google Sheets spreadsheet set up with columns for Date, Vendor, Amount, Invoice Number
N8n instance running (cloud or self-hosted)
Basic JavaScript knowledge for parsing invoice text patterns

Field Mapping

Map these fields between your apps.

FieldAPI Name
Required
Invoice Datedate
Vendor Namevendor
Invoice Amounttotal_amount
Invoice Numberinvoice_number
2 optional fields▸ show
Email Subjectemail_subject
Payment Due Datedue_date

Step-by-Step Setup

1

Workflows > New > Gmail Trigger

Connect Gmail to N8n

Set up Gmail trigger to monitor for new emails matching your invoice criteria. You'll authenticate with OAuth and configure the search filter.

  1. 1Click the + button to add a new node
  2. 2Search for 'Gmail' and select 'Gmail Trigger'
  3. 3Click 'Create New' under Credentials
  4. 4Authorize with your Google account and copy the credentials
What you should see: You should see a green 'Connected' status next to your Gmail credentials.
2

Gmail Trigger > Parameters

Configure Email Filter

Set up the Gmail trigger to only fire on emails containing invoices. Use Gmail's search operators to filter by sender domain or subject keywords.

  1. 1Set Event to 'Message Received'
  2. 2In the 'Query' field, enter 'subject:invoice OR subject:receipt OR from:billing@'
  3. 3Set 'Poll Times' to 'Every 5 minutes'
  4. 4Enable 'Include Attachments'
What you should see: The trigger configuration shows your search query and polling interval.
Common mistake — Don't use 'subject:*invoice*' — Gmail's API doesn't support wildcard searches in the middle of words.
Gmail
GM
trigger
filter
Condition
matches criteria?
yes — passes through
no — skipped
Google Sheets
GO
notified
3

Gmail Trigger > + > Extract From File

Add Text Extraction Node

Extract invoice data from email body or PDF attachments. N8n's Extract From File node handles PDF parsing automatically.

  1. 1Add a new node and select 'Extract From File'
  2. 2Set 'Binary Property' to 'attachment_0'
  3. 3Choose 'PDF' as file type
  4. 4Enable 'Extract Tables' option
What you should see: The node shows sample extracted text from a test PDF attachment.
Common mistake — PDF extraction fails on image-based invoices — you'll need OCR for scanned documents.
4

Extract From File > + > Code

Parse Invoice Fields

Use a Code node with regex or string parsing to extract specific invoice fields like amount, date, and vendor name from the raw text.

  1. 1Add a 'Code' node after the extraction
  2. 2Set Language to 'JavaScript'
  3. 3Paste the invoice parsing code in the editor
  4. 4Map input data from previous node
What you should see: The Code node output shows structured fields: vendor, amount, date, invoice_number.
Gmail fields
from
subject
snippet
body
date
available as variables:
1.props.from
1.props.subject
1.props.snippet
1.props.body
1.props.date
5

Code > + > Google Sheets

Connect Google Sheets

Authenticate with Google Sheets and select your financial tracking spreadsheet. N8n will need edit permissions to append new rows.

  1. 1Add 'Google Sheets' node
  2. 2Select 'Append' operation
  3. 3Create new Google credentials if needed
  4. 4Choose your target spreadsheet and worksheet
What you should see: Google Sheets node shows your selected spreadsheet name and available worksheets.
Common mistake — The spreadsheet must exist before setup — N8n can't create new files, only append to existing ones.
6

Google Sheets > Parameters > Values to Send

Map Invoice Data to Sheet Columns

Configure which parsed invoice fields go into which spreadsheet columns. Set up proper data formatting for dates and currency amounts.

  1. 1Set 'Data Mode' to 'Define Below'
  2. 2Map 'Date' field to column A using {{$node["Code"].json["date"]}}
  3. 3Map 'Vendor' to column B and 'Amount' to column C
  4. 4Add 'Invoice Number' and 'Email Subject' mappings
What you should see: Field mapping shows 5-6 columns with data expressions pointing to parsed invoice fields.
Common mistake — Use consistent date formatting like YYYY-MM-DD — mixed formats break spreadsheet calculations.
7

Code > Settings > Continue on Fail

Add Error Handling

Configure what happens when PDF parsing fails or required invoice fields are missing. Set up fallback behavior and error notifications.

  1. 1Click the Code node and select 'Settings'
  2. 2Set 'Continue on Fail' to true
  3. 3Add an 'IF' node after Google Sheets
  4. 4Configure condition: {{$node["Code"].json["amount"]}} exists
What you should see: Workflow shows branching paths for successful parsing vs. errors.
8

Code > + > Google Sheets (Read) > IF

Set Up Duplicate Prevention

Prevent the same invoice from being logged twice by checking existing Google Sheets rows for matching invoice numbers or email message IDs.

  1. 1Add 'Google Sheets' node with 'Read' operation before the append node
  2. 2Search existing rows for matching invoice number
  3. 3Add 'IF' node to check if invoice already exists
  4. 4Route new invoices to append, duplicates to ignore
What you should see: Workflow splits into two paths: new invoices go to Google Sheets, duplicates are skipped.
Common mistake — Gmail triggers can fire multiple times for the same email during API delays — always check for duplicates.
9

Workflow > Execute Workflow

Test with Real Invoice Email

Send a test invoice email to your Gmail account and verify the workflow extracts fields correctly and logs to the right spreadsheet rows.

  1. 1Click 'Execute Workflow' button
  2. 2Send a test email with invoice PDF to your Gmail
  3. 3Wait 5-10 minutes for Gmail trigger to fire
  4. 4Check execution log and verify Google Sheets row was added
What you should see: Execution log shows successful data extraction and a new row appears in your Google Sheets with invoice details.
n8n
▶ Run once
executed
Gmail
Google Sheets
Google Sheets
🔔 notification
received
10

Workflow > Settings > Active

Activate and Monitor

Turn on the workflow for production use and set up monitoring to catch parsing errors or API failures. Review execution logs weekly.

  1. 1Click the 'Active' toggle in top right
  2. 2Set up webhook notifications for failed executions
  3. 3Configure workflow to run every 5 minutes
  4. 4Add execution data retention settings
What you should see: Workflow status shows 'Active' and begins processing incoming invoice emails automatically.
Common mistake — Start with 5-minute polling — Gmail's API throttles faster polling and you'll hit rate limits.

Drop this into an n8n Code node.

JavaScript — Code Node// Enhanced invoice amount parsing that handles multiple currency formats
▸ Show code
// Enhanced invoice amount parsing that handles multiple currency formats
const text = items[0].json.extractedText;
const patterns = [

... expand to see full code

// Enhanced invoice amount parsing that handles multiple currency formats
const text = items[0].json.extractedText;
const patterns = [
  /(?:total|amount due)[:\s]+\$?([\d,]+\.\d{2})/i,
  /\$([\d,]+\.\d{2})\s*(?:total|due)/i,
  /([\d,]+\.\d{2})\s*USD/i
];

for (const pattern of patterns) {
  const match = text.match(pattern);
  if (match) {
    return [{json: {amount: parseFloat(match[1].replace(/,/g, ''))}}];
  }
}
return [{json: {amount: null}}];

Scaling Beyond 100+ invoices/month+ Records

If your volume exceeds 100+ invoices/month records, apply these adjustments.

1

Increase Polling Interval

Switch from 5-minute to 15-minute Gmail polling to avoid rate limits. Gmail's API throttles aggressive polling and you'll get 429 errors during busy periods.

2

Add Batch Processing

Use N8n's SplitInBatches node to process multiple invoices in chunks rather than one at a time. This reduces Google Sheets API calls and prevents timeout errors.

3

Set Up Queue Management

Add a database or webhook queue between Gmail and processing nodes to handle burst invoice volumes without losing data during API failures.

Going live

Production Checklist

Before you turn this on for real, confirm each item.

Troubleshooting

Common errors and how to fix them.

Frequently Asked Questions

Common questions about this workflow.

Analysis

VerdictWhy n8n for this workflow

Use N8n for this if you need custom invoice parsing logic or handle complex PDF layouts that generic automation tools can't parse. N8n's Code nodes let you write custom regex patterns for different vendor formats, and the Extract From File node handles PDF parsing without external APIs. Skip N8n if you only get simple invoice emails (not PDFs) — Zapier's built-in email parsing is faster to set up.

Cost

This workflow uses roughly 3-4 executions per invoice: Gmail trigger, PDF extraction, parsing, and Google Sheets write. At 50 invoices/month, that's 200 executions total. N8n's Starter plan ($20/month) includes 5,000 executions, so you're well under the limit. Zapier would cost $29.99/month for the same volume since PDF parsing requires Premium. Make charges per operation and would run about $15/month, making it the cheapest option.

Tradeoffs

Make's PDF parsing module works better out-of-the-box and handles more invoice formats without custom code. Zapier's Gmail trigger fires faster (usually under 60 seconds vs N8n's 5-minute polling). But N8n wins on flexibility — when you get a weird invoice format that breaks standard parsing, you can fix it with custom JavaScript instead of being stuck with pre-built modules.

You'll hit Gmail API rate limits if you poll too aggressively — stick to 5-minute intervals or longer. PDF extraction fails silently on password-protected files, so add error handling to catch empty results. Invoice parsing breaks when vendors change their PDF layout, which happens more often than you'd expect. Plan to update your regex patterns every few months as new invoice formats appear.

Ideas for what to build next

  • Add Slack notifications for high-value invoicesSend alerts to your finance channel when invoices over $1,000 are received, including vendor name and amount for immediate visibility.
  • Create vendor spending analyticsBuild a second workflow that reads your invoice log and generates monthly vendor spending reports with totals and trends analysis.
  • Set up payment due date remindersAdd a scheduled workflow that checks due dates and sends payment reminders 3 days before invoices are due to avoid late fees.

Related guides

Was this guide helpful?
Gmail + Google Sheets overviewn8n profile →