Skip to main content

Track email expenses from Gmail with OpenAI, Google Sheets, and Slack alerts

Workflow preview

Workflow preview
100%
Track email expenses from Gmail with OpenAI, Google Sheets, and Slack alerts preview
Open on n8n.io

1. Workflow Overview

Quick Overview This workflow monitors Gmail for invoice or receipt emails, uses OpenAI to extract an expense amount and category, logs the result to Google Sheets, and sends a Slack alert when an e...

Best for

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

Tools used

n8n-nodes-base.set, n8n-nodes-base.if, n8n-nodes-base.gmailtrigger, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.merge, n8n-nodes-base.googlesheets, n8n-nodes-base.slack, n8n-nodes-base.stickynote

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Track email expenses from Gmail with OpenAI, Google Sheets, and Slack alerts
Workflow name
Track email expenses from Gmail with OpenAI, Google Sheets, and Slack alerts

Quick Overview

This workflow monitors Gmail for invoice or receipt emails, uses OpenAI to extract an expense amount and category, logs the result to Google Sheets, and sends a Slack alert when an expense exceeds a defined threshold.

How it works

  1. Triggers every minute when a new email arrives in Gmail.
  2. Filters emails to only those with “Invoice” or “Receipt” in the subject and extracts the sender, subject, received date, and snippet text.
  3. Validates that the email content is long enough, then sends the email snippet to OpenAI to return a JSON expense amount and category.
  4. Parses and merges the AI-extracted fields with the original email metadata and formats a single expense record with a normalized date.
  5. Looks up the expense in Google Sheets by subject and date to avoid logging duplicates.
  6. Appends the expense to the Google Sheets spreadsheet and posts a Slack message if the logged amount is greater than 5000.

Setup

  1. Connect your Gmail OAuth2 credentials and ensure the Gmail Trigger has access to the mailbox you want to monitor.
  2. Add an OpenAI credential and confirm the model in the OpenAI node matches what you want to use.
  3. Connect Google Sheets using a service account, update the spreadsheet/document and sheet tab, and ensure the sheet has columns matching Date, Amount, Sender, Category, and Subject.
  4. Connect Slack OAuth2 credentials, select the target channel for alerts, and invite the Slack app/bot to that channel.

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 - Extract Email Data

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 2 - Parse AI Output

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Check High Expense

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

Block 4 - Email Listener (Gmail Trigger)

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

Block 5 - AI Expense Extractor

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 2.1

Block 6 - Merge Email + AI Data

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 7 - Format Expense Data

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 8 - Save to Expense Sheet

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

Block 9 - Slack Alert (High Expense)

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

Block 10 - Sticky Note5

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

Block 11 - Sticky Note

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

Block 12 - Sticky Note1

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

Block 13 - Sticky Note2

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

Block 14 - Filter Invoice/Receipt Emails

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

Block 15 - Validate Email Content

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

Block 16 - Filter Duplicate Records

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

Block 17 - Lookup Expense (Google Sheets)

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

3. Summary Table

Workflow Track email expenses from Gmail with OpenAI, Google Sheets, and Slack alerts
Complexity advanced
Nodes 17
Categories Invoice Processing, AI Summarization
Author WeblineIndia
Published 16 Jun 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/16431/16431.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 Track email expenses from Gmail with OpenAI, Google Sheets, and Slack alerts do?

Quick Overview This workflow monitors Gmail for invoice or receipt emails, uses OpenAI to extract an expense amount and category, logs the result to Google Sheets, and sends a Slack alert when an e...

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.