Automate Expense Tracking from Emails to Google Sheets
Automate your expense tracking by scanning receipts from emails using Mindee OCR and adding them as new rows in a Google Sheet. Eliminate manual data entry for expenses.
Overview
Automatically scans email attachments for receipts, extracts expense data using OCR, and logs it into a Google Sheet for effortless expense management.
🧠 Description & Use Case
This workflow automates the process of expense tracking by connecting your email inbox to a Google Sheet. It scans for emails containing receipts, uses Optical Character Recognition (OCR) to extract the data, and logs it in a spreadsheet, eliminating manual data entry.
🔄 How It Works:
- Check for New Emails: The workflow starts by connecting to your email server via IMAP and fetching new, unread emails from your inbox.
- Filter for Expenses: It checks if the email's subject line contains keywords like "expenses" or "receipt". This ensures that only relevant emails are processed.
- Extract Data from Receipt: For matching emails, the workflow sends the first attachment (assumed to be the receipt) to the Mindee API. Mindee's specialized OCR for receipts scans the document and extracts structured data like the total amount, date, currency, and expense category.
- Format the Data: The workflow then organizes the extracted information. It maps the data from Mindee (date, category, currency, total) and the email (subject for description) into a clean format ready for the spreadsheet.
- Add to Google Sheet: Finally, it appends all the formatted information as a new row to your specified Google Sheet, creating a perfectly organized log of your expenses.
✅ Real-World Use Cases:
- Personal Finance: Automatically track all your online purchase receipts and personal expenses without ever having to open a spreadsheet.
- Freelancers & Consultants: Effortlessly log business expenses for tax purposes. Just forward your receipts to a dedicated email address, and the workflow handles the rest.
- Small Business Accounting: Streamline the expense reporting process for your team. Employees can email their receipts, and they will be automatically logged for review by the finance department.
- Project Budgeting: Keep a real-time record of project-related expenditures by tracking receipts sent via email.
Instructions
Basic steps
- Download workflow JSON
- Import into n8n
- Configure node parameters as needed
- Test and enable the workflow
💡 Tips
After importing, verify all connectors and credentials match your environment.
Preview
Workflow Visualization
Nodes
Check subject
if
Setup Variables
set
Check for new emails
emailReadImap
Read Receipts
mindee
Set column data
set
Add to Google Sheet
googleSheets
Statistics
View full JSON structure
{
"nodes": [
{
"name": "Check subject",
"type": "n8n-nodes-base.if",
"position": [
800,
300
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"subject\"].toLowerCase()}}",
"value2": "=/{{$json[\"subjectPatterns\"].toLowerCase()}}/",
"operation": "regex"
}
]
},
"combineOperation": "any"
},
"typeVersion": 1
},
{
"name": "Setup Variables",
"type": "n8n-nodes-base.set",
"position": [
620,
300
],
"parameters": {
"values": {
"string": [
{
"name": "subjectPatterns",
"value": "(expenses|reciept)"
}
]
},
"options": {}
},
"typeVersion": 1
},
{
"name": "Check for new emails",
"type": "n8n-nodes-base.emailReadImap",
"position": [
440,
300
],
"parameters": {
"format": "resolved",
"mailbox": "Inbox",
"options": {
"allowUnauthorizedCerts": true
}
},
"credentials": {
"imap": {
"id": "24",
"name": "GMAIL"
}
},
"typeVersion": 1
},
{
"name": "Read Receipts",
"type": "n8n-nodes-base.mindee",
"position": [
1020,
280
],
"parameters": {
"binaryPropertyName": "attachment_0"
},
"credentials": {
"mindeeReceiptApi": {
"id": "61",
"name": "Mindee Receipt account"
}
},
"typeVersion": 1
},
{
"name": "Set column data",
"type": "n8n-nodes-base.set",
"position": [
1200,
280
],
"parameters": {
"values": {
"string": [
{
"name": "Date",
"value": "={{$json[\"date\"]}}"
},
{
"name": "Description",
"value": "={{$node[\"Check for new emails\"].json[\"subject\"].split(\"-\")[1]}}"
},
{
"name": "Category",
"value": "={{$json[\"category\"]}}"
},
{
"name": "Currency",
"value": "={{$json[\"currency\"]}}"
},
{
"name": "Amount",
"value": "={{$json[\"total\"]}}"
}
]
},
"options": {}
},
"typeVersion": 1
},
{
"name": "Add to Google Sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
1380,
280
],
"parameters": {
"range": "A:E",
"options": {},
"sheetId": "1xAtx1ORZYKu4urgqpOe3DawFjiWeOZO0VCVvOlQYnaE",
"operation": "append",
"authentication": "oAuth2"
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8",
"name": "Sheets"
}
},
"typeVersion": 1
}
],
"connections": {
"Check subject": {
"main": [
[
{
"node": "Read Receipts",
"type": "main",
"index": 0
}
]
]
},
"Read Receipts": {
"main": [
[
{
"node": "Set column data",
"type": "main",
"index": 0
}
]
]
},
"Set column data": {
"main": [
[
{
"node": "Add to Google Sheet",
"type": "main",
"index": 0
}
]
]
},
"Setup Variables": {
"main": [
[
{
"node": "Check subject",
"type": "main",
"index": 0
}
]
]
},
"Check for new emails": {
"main": [
[
{
"node": "Setup Variables",
"type": "main",
"index": 0
}
]
]
}
}
}Actions
Technical Specs
Compatibility
License
This workflow template follows MIT license, you can freely use, modify and distribute.
Please comply with relevant third-party service terms when using.