Invoices from Gmail to Drive and Google Sheets
Needs changesWhat this workflow does
This AI workflow has 14 nodes and runs on Gmail events. Along the way it connects Gmail, Google Drive, OpenAI Model and Google Sheets. It also calls googleapis.com over HTTP.
How it runs
Trigger: On Gmail events.
- Setup (Edit Fields (Set)): sets 1 field: url_to_drive_folder
- Only invoice mails with attachments (If): checks a condition and branches into true / false
- Upload PDF to Drive (HTTP Request): calls googleapis.com (POST)
- Gmail: mark as read
- Rename file (Google Drive): update
- Move to the correct folder (Google Drive): move
- Google Drive: download
- Extract from File: extracts data from a file (pdf)
- Apply Data Extraction Rules (Basic LLM Chain): sends a prompt to an LLM, with model: OpenAI Model; output parser: Structured Output Parser
- Map Output (Edit Fields (Set)): sets or maps fields
…plus 1 more step. See the full node list below.
Services it uses
HTTP calls to: googleapis.com
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- OpenAI Model: replace with OpenAI Chat Model.
- Also check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll).
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
| Removed in 3.0 | Replace with |
|---|---|
| OpenAI Model OpenAI Model | OpenAI Chat Model |
Nodes used (11)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - HTTP Request
n8n-nodes-base.httpRequest - Google Drive
n8n-nodes-base.googleDrive - Gmail
n8n-nodes-base.gmail - Extract from File
n8n-nodes-base.extractFromFile - OpenAI Model
@n8n/n8n-nodes-langchain.lmOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Google Sheets
n8n-nodes-base.googleSheets - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - If
n8n-nodes-base.if
From the author
Attachments Gmail to Drive and Google Sheets Description Automatically process invoice emails by saving attachments to Google Drive and extracting key invoice data to Google Sheets using AI. This workflow monitors your Gmail for unread emails with…