TL;DR This video demonstrates how to build a no-code bookkeeping automation agent using n8n to eliminate manual receipt matching. The system integrates bank transactions via Google Sheets, processes incoming email receipts (images or PDFs) using AI and OCR (Mistral OCR), and intelligently matches them to the correct bank transactions, even with similar charges, prioritizing recent activity. It extracts key invoice data, uploads attachments to Google Drive, and updates a central finance reconciliation sheet. For unmatched receipts, it stores them separately for easy manual reconciliation. This automation aims to save significant time, handling approximately 95% of the work, and is designed for future integration with accounting software like QuickBooks or Xero. The setup is estimated to take just 15 minutes, with a template available for quick deployment.
Information Mind Map
- Problem: Manual receipt matching is time-consuming and inefficient.
- Solution: Automate the process using n8n to match receipts to bank transactions.
- Benefits:
- Eliminates manual matching.
- Finds correct transactions even with multiple similar charges.
- Reads receipts from images or PDFs using character recognition.
- Handles unmatched receipts for easy manual reconciliation.
- High ROI for time invested (15-minute setup).
- Automates ~95% of the work.
- 1. Raw Transactions from Bank Account
- Source: Bank account (e.g., Monzo) or third-party integrations.
- Destination: Google Sheet (e.g., "Live Transaction Sheet").
- Data Captured: Company name, category, amount, local currency.
- First Automation:
Google Sheet triggerβ As soon as a transaction enters the "Live Transaction Sheet", it's appended to the "Central Finance Reconciliation Sheet".- Actionable:
- Make a copy of the provided Google Sheet template.
- Map bank transaction columns to "Raw Live Sheet" columns.
- Actionable:
- 2. Central Finance Reconciliation Sheet
- Purpose: Main database for all transactions and receipts.
- Components:
Lookups: To match categories (e.g., 11 Labs -> Software).Raw Live Sheet: Where bank transactions are logged and processed.Receipt/Invoice Columns:- Email address of origin.
- Link to original email.
- Link to Google Drive file (or Dropbox/Shared Drive).
- Standardized file name.
- Extracted text from receipt.
- Download link for the file.
- Outcome: Transactions with direct links to receipts, ready for accounting software upload or internal reporting.
- 3. Unmatched Receipts Tab
- Purpose: Stores receipts that could not be matched to an existing transaction.
- Details Captured: Links to email, file, total due, etc.
- Benefit: Simplifies manual reconciliation for edge cases, ensuring no receipts are lost.
- Trigger:
Google Mail(checks designated accounting mailbox, e.g.,accounting@scrapes.ai, every minute).- Pulls email details and attachments.
- AI Check 1: Assess Email Relevance (
LLM node)- Input: Email subject, email body.
- Prompt: Acts as an "email processing agent" to identify emails with invoices or billing content.
- Output:
True(process) orFalse(stop execution to save AI tokens). - Filter Node: Passes to next stage if
True.
- Extract Key Info about Invoice (
LLM node)- Input: Email subject, email body.
- Prompt: Pulls invoice information only from email text (description, invoice date, payment date, invoice number, etc.).
- Crucial Rule: "If the email body or subject does not contain this information, leave it blank. do not make up this information."
- Prioritizes attachments as the "source of truth" over email body.
- Attachment Handling
Code Node: Grabs binary data from the original email for attachment.- Check for Existing Attachment:
- If Exists: Skip upload.
- If Not Exists:
Save Attachment to Invoice File(Google Drive Uploadnode).- Naming Convention: Date_SupplierName_EmailInfo (e.g.,
2023-08-15_Slack_invoice_link_to_email). - Destination:
Invoice Uploadsfolder in Google Drive.
- Trigger:
Google Drive Trigger(starts when new attachments are received in theInvoice Uploadsfolder).- Actionable:
- Connect Google Drive account.
- Ensure URL in trigger points to the correct
Invoice Uploadsfolder.
- Actionable:
- Download Google Drive File
- Determine File Type: Checks
mime type(image vs. PDF).- Branch 1: Image (mime type
imageorcontains image)Mistral OCR: Optical Character Recognition.- Function: Views receipts visually, extracts text from unstructured data (images).
- Cost: ~$1 per 1000 pages (cost-effective).
- Process:
HTTP Request(upload binary file to Mistral server to get file URL).HTTP Request(send document URL to Mistral for OCR processing).JSONpayload specifiesimage_url.
- Branch 2: PDF
Mistral OCR: Optical Character Recognition.- Function: Extracts text from PDFs (even if they contain images).
- Process:
HTTP Request(upload binary file to Mistral server to get file URL).HTTP Request(send document URL to Mistral for OCR processing).JSONpayload specifiesdocument_url.
- Branch 1: Image (mime type
- Extract Amount Due (
LLM node)- Input: Markdown/text received from Mistral OCR.
- Prompt: "Review the whole bit of text and work out what is the amount due."
- Amount due is considered the single best identifier for matching.
- Pull Live Transactions (
Google Sheet Readnode)- Source: "Raw Live Sheet".
- Sorts transactions by most recent (recency bias for matching).
- Transaction Matching Loop (
LLM nodewithin a loop)- Input:
- Transaction data from each row (can be limited to
most recent 10). - Invoice markdown (from OCR, constant for each loop).
- Transaction data from each row (can be limited to
- Prompt: "You're a transaction matching agent. Compare the invoice data with the existing transaction records. Return true or false. Here are your inputs. Extract invoice key data and make sure that you are sure that this transaction matches."
- Output:
True(match found) orFalse(no match). - Logic:
- If
True:Update Google Sheet(matches transaction with receipt details). - If
False: Continue loop to next transaction.
- If
- Input:
- Handle Unmatched Receipts
- If no match found after loop:
Upload to Unmatched Receiptstab in Google Sheet. - Purpose: Ensures all receipts are stored, even if no bank transaction match is found, for later manual reconciliation.
- If no match found after loop:
- 1. Matching with Multiple Similar Transactions (PDF)
- Example: Slack invoices (June, July, August).
- Outcome: System correctly identifies and matches the July invoice based on date and amount, leveraging AI and recency bias.
- 2. Processing Image Receipts
- Example: Restaurant meal receipt (image).
- Outcome: System uses Mistral OCR to extract text from the image and successfully matches it to the corresponding transaction.
- 3. Handling Unmatched Transactions (PDF)
- Example: Google Cloud invoice not on transaction list.
- Outcome: Receipt is processed, but since no match is found, it's stored in the "Unmatched Receipts" tab for manual review.
- Note: May require manual input for missing data (e.g., invoice date).
- Integration with Accounting Software: QuickBooks, Zero, Free Agent.
- Will allow direct upload of reconciled documents.
- Community & Template:
- Grab the complete template and setup guide from
school.com/scrapes(Resource Hub -> Bookkeeping under Operations). - Option to build logic yourself for free.
- Grab the complete template and setup guide from