Skip to main content

Automated invoice processing & filing with IMAP, AI, Google Drive & DateV

Workflow preview

Workflow preview
100%
Automated invoice processing & filing with IMAP, AI, Google Drive & DateV preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n template demonstrates how to automatically process incoming invoice emails using AI to extract structured data, organize files in Google Drive, log everything in Google Sheets, and forward...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.extractfromfile, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.code, n8n-nodes-base.googledrive, n8n-nodes-base.splitinbatches, n8n-nodes-base.googlesheets, n8n-nodes-base.emailreadimap, n8n-nodes-base.emailsend

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Automated invoice processing & filing with IMAP, AI, Google Drive & DateV
Workflow name
Automated invoice processing & filing with IMAP, AI, Google Drive & DateV

This n8n template demonstrates how to automatically process incoming invoice emails using AI to extract structured data, organize files in Google Drive, log everything in Google Sheets, and forward to your accounting system, completely hands-free.

Use cases are many: Perfect for freelancers managing client invoices, small businesses handling supplier bills, accounting departments processing high invoice volumes, or anyone who wants to eliminate manual data entry and maintain a perfectly organized invoice archive!

Good to know

  • The AI extraction works with most standard invoice formats but may require prompt adjustments for unusual layouts.
  • Ensure your IMAP email account allows external app connections and has sufficient storage for the archive folder.
  • Google Drive folder structure is automatically created if it doesn't exist yet.

How it works

  • The IMAP Email trigger monitors your inbox for new messages with attachments. JavaScript splits multiple attachments into separate items, ensuring each invoice is processed individually. PDF text extraction reads the content from each invoice file.
  • An AI model (like OpenAI or Gemini) analyzes the extracted text and identifies key fields: company name, invoice number, date, amount, VAT, and more.
  • Additional date metadata is generated (month, year, formatted dates) for smart categorization.
  • The invoice PDF is uploaded to a temporary "Incoming Files" folder on Google Drive for safe processing.
  • The workflow searches for or creates the correct monthly folder (e.g., "Invoices / October 2025") in your Drive structure. The invoice is moved to the final destination with a clean, standardized filename: 2025-10-02_Company-Name_InvoiceNumber.pdf.
  • All extracted data is logged to Google Sheets for easy tracking, reporting, and audit trails.
  • The finalized invoice is forwarded to your DateV accounting email inbox.
  • The original email is automatically moved to an archive folder, keeping your inbox clean and organized.

How to use

  • The IMAP trigger is configured for continuous monitoring, but you can adjust the polling interval based on your needs.
  • Customize the AI prompt to match your specific invoice formats or extract additional fields relevant to your business.
  • The folder structure on Google Drive can be modified to match your existing organization system.

Requirements

  • IMAP-enabled email account (Gmail, Outlook, or any email provider supporting IMAP)
  • Google Drive account for file storage
  • Google Sheets for invoice logging
  • AI model access (OpenAI, Gemini, or compatible LLM for data extraction)
  • DateV email address (or replace with your preferred accounting system)

Customising this workflow

  • Replace the DateV email step with integrations to other accounting platforms like Xero, QuickBooks, or Lexoffice.
  • Add conditional logic to route different invoice types to different folders or sheets.
  • Extend the AI extraction to include line items, payment terms, or custom fields specific to your industry.
  • Connect additional notifications via Slack, Teams, or SMS when high-value invoices are received.

Disclaimer: The node to move the e-mail is a community-node, so it’s only for self-hosting.

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 - Extract From PDF

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

Block 2 - Extract & Format Data

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 3 - Get Additional Date Data

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

Block 4 - Search Month Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 5 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 6 - Google Sheets

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

Block 7 - Email Trigger (IMAP)

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

Block 8 - Send to DateV

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

Block 9 - MoveEmail email

Type / Role
n8n-nodes-imap.imap - imap
Config choices
Version 1

Block 10 - Sticky Note

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

Block 11 - Sticky Note1

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

Block 12 - Sticky Note2

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

Block 13 - Sticky Note3

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

Block 14 - Sticky Note4

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

Block 15 - Sticky Note5

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

Block 16 - Upload file

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 17 - Code in JavaScript

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

Block 18 - Download file

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 19 - Download file1

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 20 - Download file2

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 21 - Download file3

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 22 - Upload file1

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 23 - Sticky Note6

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

3. Summary Table

Workflow Automated invoice processing & filing with IMAP, AI, Google Drive & DateV
Complexity advanced
Nodes 23
Categories Invoice Processing, AI Summarization
Author Jan Zaiser
Published 09 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9439/9439.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 Automated invoice processing & filing with IMAP, AI, Google Drive & DateV do?

This n8n template demonstrates how to automatically process incoming invoice emails using AI to extract structured data, organize files in Google Drive, log everything in Google Sheets, and forward...

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 Invoice Processing, AI Summarization use case.