Process and log Gmail invoices with GPT-4.1-mini, Google Sheets, and Drive
Ready for 3.0What this workflow does
This AI workflow has 27 nodes and runs on a schedule (every day at 07:00). Along the way it connects Google Sheets, Gmail, OpenAI Chat Model and Google Drive.
How it runs
Trigger: On a schedule (every day at 07:00).
- Configure Workflow Settings (Edit Fields (Set)): sets 7 fields: digestTo, spreadsheetId, invoicesSheet…
- Fetch Invoices from Sheets (Google Sheets): uses Google Sheets
- Retrieve Unread Gmail (Gmail): get many
- Decode Gmail Entities (Code): runs custom JavaScript code
- Extract Text from PDF Files (Extract from File): extracts data from a file (pdf)
- Combine PDF Metadata and Text (Code): runs custom JavaScript code
- Extract Fields with AI (Basic LLM Chain): sends a prompt to an LLM, with model: OpenAI GPT-4.1-mini
- Convert JSON to Invoice Data (Code): runs custom JavaScript code
- Identify and Match Vendors (Code): runs custom JavaScript code
- Structure Invoice for Sheets (Code): runs custom JavaScript code
…plus 15 more steps. See the full node list below.
Services it uses
Other Google Sheets + Gmail templates (2,102) · Other OpenAI + Google Sheets templates (2,011) · Other OpenAI + Gmail templates (1,623)
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.
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (13)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - Google Sheets
n8n-nodes-base.googleSheets - Gmail
n8n-nodes-base.gmail - Code
n8n-nodes-base.code - Extract from File
n8n-nodes-base.extractFromFile - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - If
n8n-nodes-base.if - Google Drive
n8n-nodes-base.googleDrive - Merge
n8n-nodes-base.merge - Filter
n8n-nodes-base.filter - Switch
n8n-nodes-base.switch
From the author
Quick overview This workflow runs daily, fetches unread Gmail messages, uses OpenAI (GPT-4.1-mini) to classify and extract invoice/receipt fields (including PDF text), saves PDF attachments to Google Drive, logs invoices/receipts to Google Sheets, and emails…