Skip to main content

Classify and route email attachments with easybits, Gmail and Google Drive

Workflow preview

Workflow preview
100%
Classify and route email attachments with easybits, Gmail and Google Drive preview
Open on n8n.io

1. Workflow Overview

What This Workflow Does Receive any business document via email. The attachment is automatically classified (Invoice, Contract, or Purchase Order) using easybits Extractor, then routed down the cor...

Best for

  • Document Extraction automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@easybits/n8n-nodes-extractor.easybitsextractor, n8n-nodes-base.gmailtrigger, n8n-nodes-base.switch, n8n-nodes-base.merge, n8n-nodes-base.googledrive, n8n-nodes-base.googlesheets, n8n-nodes-base.slack, n8n-nodes-base.stickynote

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Classify and route email attachments with easybits, Gmail and Google Drive
Workflow name
Classify and route email attachments with easybits, Gmail and Google Drive

What This Workflow Does

Receive any business document via email. The attachment is automatically classified (Invoice, Contract, or Purchase Order) using easybits Extractor, then routed down the correct path where a second Extractor pulls out document-specific data. Each route stores the file in Google Drive and triggers the appropriate action – Invoices go to a finance spreadsheet, Contracts and Purchase Orders trigger Slack notifications.

How It Works

  1. Receive – Gmail polls for new emails with attachments every minute
  2. Classify – easybits Extractor identifies the document type and returns a class label
  3. Route – A Switch node sends the item down the matching path (Invoice / Contract / PO)
  4. Merge Binary – The original file is merged back into the routed item (classification strips the binary)
  5. Extract – A second easybits Extractor pulls fields specific to that document type
  6. Merge Data + File – Extracted JSON and original binary are combined for upload
  7. Store & Notify – The file is uploaded to Google Drive; Invoices update a spreadsheet, Contracts and POs trigger Slack alerts

Setup Guide

1. Create Your easybits Classification Pipeline

  1. Go to extractor.easybits.tech and create a new pipeline
  2. Add one field called document_class
  3. In the field prompt, describe your classification categories and how to identify each one (see the "easybits: Classify Document" node for a reference prompt)
  4. The prompt should instruct the model to return exactly one category label – no explanations, no extra text
  5. Adjust the categories and identification criteria to match your specific document types
  6. Copy your Pipeline ID and connect the credential in the classification node

> 💡 Tip: The classification prompt is the heart of this workflow. The more specific your category descriptions and decision rules are, the more accurate your results will be.

2. Create Three Extraction Pipelines

Create one pipeline per document type on extractor.easybits.tech:

  • Invoice pipeline – fields: invoice_number, total_amount, currency, due_date, vendor_name
  • Contract pipeline – fields: client_name, contract_type, contract_value, currency, start_date, notice_period
  • Purchase Order pipeline – fields: supplier_name, po_number, order_date, expected_delivery_date, total_amount, currency

Connect each pipeline's credentials to the matching Extractor node.

3. Set Up Gmail

Connect your Gmail account via OAuth2. Optionally filter by label to only process specific emails. Make sure Download Attachments is enabled in the node options.

4. Set Up Google Drive

Create three folders in Google Drive: Invoices, Contracts, Purchase Orders. Select the correct folder in each Upload node. Set the Input Binary Field to attachment_0 (or whichever field carries the PDF).

5. Set Up Google Sheets

Create a spreadsheet (or use an existing Master Finance File). Make sure the column headers match the field mappings in the "Update Master Finance Sheet" node.

6. Set Up Slack

Connect your Slack workspace. Select the channel for contract notifications (e.g. #contracts) and the channel for PO updates (e.g. #operations). Adjust the message templates if your extracted field names differ.

7. Activate & Test

Set the workflow to active and send a test email with an invoice, contract, and purchase order attached to verify each route works end to end.

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 - Extractor: Purchase Orders

Type / Role
@easybits/n8n-nodes-extractor.easybitsExtractor - easybitsExtractor
Config choices
Version 2

Block 2 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.3

Block 3 - easybits: Classify Document

Type / Role
@easybits/n8n-nodes-extractor.easybitsExtractor - easybitsExtractor
Config choices
Version 2

Block 4 - Route by Document Type

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.4

Block 5 - Merge: Invoice Binary

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 6 - Merge: Contract Binary

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 7 - Merge: Purchase Order Binary

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 8 - easybits: Extract Invoice

Type / Role
@easybits/n8n-nodes-extractor.easybitsExtractor - easybitsExtractor
Config choices
Version 2

Block 9 - easybits: Extract Contract

Type / Role
@easybits/n8n-nodes-extractor.easybitsExtractor - easybitsExtractor
Config choices
Version 2

Block 10 - Merge: Invoice Data + File

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 11 - Merge: Contract Data + File

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 12 - Merge: Purchase Order Data + File

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 13 - Upload Invoice to Drive

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

Block 14 - Upload Contract to Drive

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

Block 15 - Upload Purchase Order to Drive

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

Block 16 - Update Master Finance Sheet

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

Block 17 - Slack: Notify Sales – New Contract

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

Block 18 - Slack: Notify Team – Restock Update

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

Block 19 - Sticky Note

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

Block 20 - Sticky Note1

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

Block 21 - Sticky Note2

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

Block 22 - Sticky Note3

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

Block 23 - Sticky Note4

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

Block 24 - Sticky Note5

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

Showing the first 24 of 27 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Classify and route email attachments with easybits, Gmail and Google Drive
Complexity advanced
Nodes 27
Categories Document Extraction, AI Summarization
Author Felix
Published 10 Apr 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14978/14978.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 Classify and route email attachments with easybits, Gmail and Google Drive do?

What This Workflow Does Receive any business document via email. The attachment is automatically classified (Invoice, Contract, or Purchase Order) using easybits Extractor, then routed down the cor...

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 Document Extraction, AI Summarization use case.