Automate Expense Extraction from Emails to Google Sheets with n8n

Tired of manually tracking your expense receipts from emails? This n8n workflow automates extracting receipt details from email attachments and adds them directly to Google Sheets, saving you hours and reducing errors in expense management.
emailReadImap
mindee
googleSheets
+2
Workflow Identifier: 1039
NODES in Use: EmailReadImap, Set, If, Mindee, Google Sheets

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Automation Does

This workflow checks emails, finds receipts, pulls expense info, and adds it to a Google Sheet automatically.
It saves you time and reduces errors by avoiding manual entry.

It reads Gmail inbox emails with receipt keywords, extracts data using AI, formats it, and adds it to a spreadsheet.
You get a neat, up-to-date budget tracker without extra work.


Tools and Services Used


Inputs, Processing, and Output

Inputs

  • Emails from Gmail Inbox matching specific subject patterns.
  • Attachment images containing expense receipts.

Processing Steps

  • Filter emails with subjects including keywords like “expenses” or “reciept”.
  • Extract receipt information with Mindee AI on the attachment.
  • Format the extracted info into date, description, category, currency, and amount.

Output

  • Rows appended automatically to a Google Sheets expense tracker.
  • Up-to-date, error-reduced expense records for easy review.

Beginner Step-by-Step: How to Use This Workflow in n8n

Importing the Workflow

  1. Download the workflow JSON file using the Download button on this page.
  2. Open the n8n editor where you want to use it.
  3. Use the “Import from File” feature to load the workflow.

Configuring the Workflow

  1. Add your Gmail IMAP credentials in the EmailReadImap node settings.
  2. Enter your Mindee API Key in the Mindee Receipt node.
  3. Set up Google Sheets OAuth2 credentials in the Google Sheets node.
  4. Check and update Spreadsheet ID, sheet name, and range if your setup is different.

Testing and Running

  1. Run the workflow once manually to make sure it works.
  2. Look at the output in Google Sheets to confirm data appears correctly.
  3. Activate the workflow by toggling the “Active” switch to run automatically for new emails.

Remember, if running self-host n8n, visit this resource for help.


Step-by-Step Guide

Step 1: Set Up Email Retrieval from Gmail

In n8n, add an EmailReadImap node.
Navigate to Nodes → EmailReadImap.
Configure the node to use your Gmail IMAP credentials (allow unauthorized certs if needed).
Set mailbox to “Inbox”.
You should see emails and their subjects when node runs.
Make sure IMAP is enabled in Gmail settings.

Step 2: Define Subject Patterns to Identify Receipt Emails

Add a Set node named Setup Variables.
Create string variable subjectPatterns with value (expenses|reciept), note misspelling.
This tells workflow which emails to pick.

Step 3: Filter Emails Based on Subject Using the If Node

Add an If node named Check subject.
Set condition: email subject lowercase matches regex subjectPatterns.
Only matching emails go forward.
Convert subject to lowercase or it might not match.

Step 4: Extract Receipt Data from Email Attachments with Mindee Node

Insert Mindee Receipt node.
Connect it after Check subject node for filtered emails.
Use attachment_0 as binaryPropertyName.
Add Mindee API Credentials.
Receives data like date, total, currency, and category.
Ensure emails have attachments properly loaded.

Step 5: Format Extracted Data into Sheet Columns

Add a Set node named Set column data.
Map fields from Mindee output:

  • Date => {{$json["date"]}}
  • Description => second part of email subject split by “-” (e.g. “Expense – Uber”)
  • Category => {{$json["category"]}}
  • Currency => {{$json["currency"]}}
  • Amount => {{$json["total"]}}

This makes spreadsheet neat.
Check for typos or field name errors.

Step 6: Append Data to Google Sheets

Add Google Sheets node set to append mode.
Put right spreadsheet ID, e.g. 1xAtx1ORZYKu4urgqpOe3DawFjiWeOZO0VCVvOlQYnaE.
Set range to A:E.
Use OAuth2.
New expenses show up as new rows.
Verify Sheet ID and permissions if errors happen.


Customizations ✏️

  • Expand keywords in Setup Variables node by changing subjectPatterns to include “invoice” or “bill”.
  • Process multiple attachments by modifying Mindee Receipt node to use attachment_1 or others.
  • Add a Function node to calculate tax on the total after data extraction.
  • Insert email or Slack notification nodes after the Google Sheets append to alert on new entries.
  • Make Google Sheets range selection dynamic, e.g., by header names, for future-proofing.

Troubleshooting 🔧

Problem: No emails appear in the EmailReadImap node.
Cause: IMAP not enabled or wrong credentials.
Solution: Enable IMAP in Gmail, check username and password.

Problem: Mindee Receipt node errors or returns empty.
Cause: Missing or wrong attachments.
Solution: Confirm emails have attachments and node uses correct binaryPropertyName.

Problem: Google Sheets append fails silently.
Cause: Wrong Sheet ID or no permission.
Solution: Verify Sheet ID from URL and OAuth2 setup.


Pre-Production Checklist ✅

  • Check Gmail IMAP is enabled and credentials are right.
  • Test Mindee API connection and email attachments.
  • Confirm Google Sheets ID and OAuth2 permissions for edits.
  • Run workflow with sample emails to verify outputs.
  • Backup spreadsheet or duplicate it before live run.

Deployment Guide

After tests succeed, turn on the workflow in the n8n editor using the “Active” switch.
This lets the workflow auto-run on new receipt emails.

Watch the execution logs for problems.
Add notifications nodes if needed to alert on errors.


Conclusion

This workflow stops manual data entry of receipt expenses.
It saves hours weekly and lowers errors by automating from email to spreadsheet.

Users can next expand automation for invoices or sync with accounting software.
Try self-host n8n to keep control on own servers.


Summary

✓ Saves time by automating expense entry from emails.
✓ Reduces mistakes by using AI to extract data.
✓ Keeps expense spreadsheet updated instantly.
✓ Easy to configure and test inside n8n.
✓ Works well with Gmail, Mindee, and Google Sheets.


Frequently Asked Questions

The workflow uses a regular expression filter on email subjects checking for keywords like “expenses” or “reciept” to select relevant emails.
The Mindee Receipt node requires an attachment named “attachment_0”. If missing, the workflow skips extracting data for that email.
It uses the Google Sheets node in append mode with OAuth2 authentication, adding new rows with formatted expense data into specified spreadsheet and range.
Yes, the workflow can run on any n8n setup including for self-host n8n.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free