Skip to main content

Audit SaaS subscription waste from Gmail with GPT-4.1-mini and Google Sheets

Workflow preview

Workflow preview
100%
Audit SaaS subscription waste from Gmail with GPT-4.1-mini and Google Sheets preview
Open on n8n.io

1. Workflow Overview

Quick overview This workflow runs on a schedule to scan Gmail for subscription and billing emails, uses OpenAI GPT 4.1 mini to extract and classify SaaS spend and potential waste, upserts results i...

Best for

  • Document Extraction automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.scheduletrigger, n8n-nodes-base.gmail, n8n-nodes-base.code, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, n8n-nodes-base.gmailtool, @n8n/n8n-nodes-langchain.toolworkflow

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Audit SaaS subscription waste from Gmail with GPT-4.1-mini and Google Sheets
Workflow name
Audit SaaS subscription waste from Gmail with GPT-4.1-mini and Google Sheets

Quick overview

This workflow runs on a schedule to scan Gmail for subscription and billing emails, uses OpenAI GPT-4.1-mini to extract and classify SaaS spend and potential waste, upserts results into Google Sheets, and emails an HTML digest report via Gmail.

How it works

  1. Runs on a monthly schedule trigger (configurable to weekly) to start an inbox audit.
  2. Searches Gmail for the last 30 days of messages that match billing, invoice, subscription, renewal, payment, and re-engagement keywords.
  3. Filters out marketing noise and keeps only messages that look like real billing signals, then fetches each email’s full body from Gmail.
  4. Uses an OpenAI GPT-4.1-mini agent to determine whether each email is billing-related, extract structured subscription fields (like vendor, amount, cycle, and renewal date), and optionally call back into Gmail search and message retrieval to confirm details and usage signals.
  5. Cleans and validates the AI-produced JSON, recalculates annualized cost, and routes low-confidence or parse-failed items for review.
  6. Upserts one row per vendor into a Google Sheets “Dashboard” tab and then builds a branded HTML report summarizing total spend and flagged waste categories.
  7. Sends the HTML digest report to the configured recipient using Gmail.

Setup

  1. Connect Gmail OAuth2 credentials for the Gmail search, message retrieval, and report-sending steps, and set the recipient address in the Gmail send action.
  2. Add an OpenAI API credential and ensure the agent uses the GPT-4.1-mini model.
  3. Connect Google Sheets OAuth2 credentials, set your Google Sheet document ID, and create a “Dashboard” sheet with columns matching the extracted fields (with Vendor used as the upsert key).
  4. If you want the agent to use Gmail search as a tool, set the tool workflow ID for the Gmail Search sub-workflow and ensure the sub-workflow’s Gmail node uses the same Gmail credential.
  5. Update the schedule interval (monthly by default) and optionally customize the Gmail search query keywords and the HTML report branding values.

Requirements

  • Active n8n instance (self-hosted or cloud) Gmail account containing subscription and billing emails OpenAI account with GPT-4.1-mini API access Google Sheets with a tab named Dashboard Google Sheets with a tab named Dashboard

Customization

  • Change the scan frequency — edit the schedule in node 1 from monthly to weekly using cron expression 0 9 * * 1 Extend the Gmail search window — change newer_than:30d in node 2 to newer_than:60d or newer_than:90d to catch quarterly and annual billing cycles Add noise filter terms — add words like trial or free plan to the drop array in node 3 to exclude free-tier emails from AI analysis Add a Slack alert — after the Gmail send step, add a Slack node to post High Priority flagged vendors and their annual cost to a team channel Update brand name in report — find const brand = 'YOUR_BRAND_NAME' in the Build HTML Report code and replace it with your actual name

Additional info

This workflow includes an embedded sub-workflow (visible at the bottom of the canvas) that handles Gmail search queries called by the AI Agent tool. Both workflows must be imported and activated separately. Activate the sub-workflow before the main workflow.

The AI agent uses up to 4 Gmail tool calls per email to confirm amounts, find renewal dates, and check for re-engagement emails that signal an unused subscription.

Gmail image-only billing emails where the amount appears in a graphic rather than text will consistently score below the 0.60 confidence threshold and route to review. Those rows are still saved to the sheet for manual verification.

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 - Section — Schedule, Gmail Search, Noise Filter, and Body Fetch

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

Block 3 - Section — AI Agent 5-Step Subscription Extraction and Waste Analysis

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

Block 4 - Section — JSON Parse, Validate, and Sheets Upsert

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

Block 5 - Section — HTML Report Build and Gmail Send

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

Block 6 - Section — Gmail Search Sub-Workflow

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

Block 7 - 1. Schedule — Monthly Billing Scan

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

Block 8 - 2. Gmail — Search Billing and Usage Emails

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 9 - 3. Code — Prefilter Noise

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - 4. Gmail — Get Email Body

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 11 - 5. AI Agent — Extract and Analyze Subscription

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 12 - OpenAI — GPT-4.1-mini Model

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

Block 13 - Get a message in Gmail

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

Block 14 - Call Gmail Search

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2.2

Block 15 - 6. Code — Parse and Validate

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - 7. Google Sheets — Upsert Dashboard

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

Block 17 - 8. Code — Build HTML Report

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 18 - 9. Gmail — Send Weekly Report

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 19 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 20 - Gmail Search

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

3. Summary Table

Workflow Audit SaaS subscription waste from Gmail with GPT-4.1-mini and Google Sheets
Complexity advanced
Nodes 20
Categories Document Extraction, AI Summarization
Author Incrementors
Published 25 May 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15945/15945.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 Audit SaaS subscription waste from Gmail with GPT-4.1-mini and Google Sheets do?

Quick overview This workflow runs on a schedule to scan Gmail for subscription and billing emails, uses OpenAI GPT 4.1 mini to extract and classify SaaS spend and potential waste, upserts results 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 Document Extraction, AI Summarization use case.