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 Receive – Gmail polls for new emails with attachments every minute Classify – easybits Extractor identifies the document type and returns a class label Route – A Switch node sends the item down the matching path (Invoice / Contract / PO) Merge Binary – The original file is merged back into the routed item (classification strips the binary) Extract – A second easybits Extractor pulls fields specific to that document type Merge Data + File – Extracted JSON and original binary are combined for upload 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 Go to extractor.easybits.tech and create a new pipeline Add one field called document_class In the field prompt, describe your classification categories and how to identify each one (see the "easybits: Classify Document" node for a reference prompt) The prompt should instruct the model to return exactly one category label – no explanations, no extra text Adjust the categories and identification criteria to match your specific document types 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.

  1. 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.

  1. 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.

  2. 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).

  3. 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.

  4. 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.

  5. 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.

0
Downloads
0
Views
8.12
Quality Score
beginner
Complexity
Created:4/16/2026
Updated:4/28/2026

🔒 Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments