Archive and index legal PDFs from Gmail with Gemini, Sheets and Google Drive
Ready for 3.0What this workflow does
This AI workflow has 16 nodes and runs on Gmail events. Along the way it connects Gmail, Google Gemini Chat Model, Google Sheets and Google Drive and 1 more.
How it runs
Trigger: On Gmail events.
- Extract Document Text (Extract from File): extracts data from a file (pdf)
- Extract Filing Metadata with Gemini (Basic LLM Chain): sends a prompt to an LLM, with model: Google Gemini Chat Model; output parser: Filing Metadata Parser
- Build Compliant File Name (Code): runs custom JavaScript code
- Report Extraction Failure (Slack): uses Slack
- Check Required Metadata (If): checks a condition and branches into true / false
- Index for Legal Search (Google Sheets): append
- Report Incomplete Metadata (Slack): uses Slack
- Mark Email as Filed (Gmail): mark as read
- Route by Document Type (Switch): routes items into 3 branches
- Archive to Invoices Folder (Google Drive): uses Google Drive
…plus 3 more steps. See the full node list below.
Services it uses
Other Google Sheets + Gmail templates (2,102) · Other Google Sheets + Slack templates (1,314) · Other Gmail + Slack templates (957)
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (12)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Extract from File
n8n-nodes-base.extractFromFile - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Google Sheets
n8n-nodes-base.googleSheets - Gmail
n8n-nodes-base.gmail - Switch
n8n-nodes-base.switch - Google Drive
n8n-nodes-base.googleDrive - Slack
n8n-nodes-base.slack
From the author
Quick Overview This workflow monitors Gmail for unread emails with PDF attachments, uses Google Gemini to extract Japan Electronic Books Preservation Act filing metadata, logs a searchable index in Google Sheets, and archives documents into Google Drive…