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
Automate expense extraction with n8n and Google Sheets

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

Learn how to Build this Workflow with AI:

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.


Automate expense extraction with n8n and Google Sheets

Visit through Desktop to Interact with the Workflow.

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 Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.