Skip to main content

Extract invoice data from Gmail PDFs to Google Sheets with OpenAI and Slack

Workflow preview

Workflow preview
100%
Extract invoice data from Gmail PDFs to Google Sheets with OpenAI and Slack preview
Open on n8n.io

1. Workflow Overview

Quick Overview This workflow monitors Gmail for emails with PDF attachments, extracts invoice fields with OpenAI, logs the results to a Google Sheets bookkeeping spreadsheet, and posts high value i...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.gmailtrigger, n8n-nodes-base.extractfromfile, @n8n/n8n-nodes-langchain.chainllm, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.googlesheets, n8n-nodes-base.if

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Abhishek Gawade.

Original n8n.io source

1.1 Workflow description

Title
Extract invoice data from Gmail PDFs to Google Sheets with OpenAI and Slack
Workflow name
Extract invoice data from Gmail PDFs to Google Sheets with OpenAI and Slack

Quick Overview

This workflow monitors Gmail for emails with PDF attachments, extracts invoice fields with OpenAI, logs the results to a Google Sheets bookkeeping spreadsheet, and posts high-value invoices to Slack for approval.

How it works

  1. Triggers every minute when Gmail finds a new email matching the search query and downloads its attachments.
  2. Extracts text from the first PDF attachment in the email.
  3. Sends the extracted text to OpenAI (gpt-4o-mini) to return structured invoice data (vendor, dates, amounts, currency, category, and summary) as JSON.
  4. Appends the extracted invoice fields to a Google Sheets worksheet and marks the entry as Unpaid with the current received timestamp.
  5. Checks whether the invoice total is greater than or equal to 1000.
  6. Posts a Slack message to a selected channel to request approval for invoices that meet the high-value threshold.

Setup

  1. Connect your Gmail, OpenAI, Google Sheets, and Slack credentials in n8n.
  2. Update the Gmail search query in the Gmail trigger to target the invoice emails you want to process (for example, by label, sender, or subject).
  3. Replace YOUR_GOOGLE_SHEET_ID with your spreadsheet ID and ensure the target sheet has columns matching Vendor, Invoice #, Invoice Date, Due Date, Currency, Category, Tax, Total, Status, and Received.
  4. Set the Slack channel to post into and adjust the approval threshold amount (currently 1000) to match your policy.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Overview

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Warning

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Section: Capture

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Section: Extract

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Section: Record

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - New Invoice Email

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 7 - Extract Text from PDF

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 8 - Extract Invoice Fields

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.5

Block 9 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 10 - Parse Invoice (JSON)

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 11 - Log to Bookkeeping Sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 12 - High-Value?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 13 - Send for Approval

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

3. Summary Table

Workflow Extract invoice data from Gmail PDFs to Google Sheets with OpenAI and Slack
Complexity intermediate
Nodes 13
Categories Invoice Processing, AI Summarization
Author Abhishek Gawade
Published 13 Jun 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/16331/16331.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Extract invoice data from Gmail PDFs to Google Sheets with OpenAI and Slack do?

Quick Overview This workflow monitors Gmail for emails with PDF attachments, extracts invoice fields with OpenAI, logs the results to a Google Sheets bookkeeping spreadsheet, and posts high value i...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Invoice Processing, AI Summarization use case.