Send portfolio risk reports from Google Sheets with OpenAI and Gmail
Needs changesWhat this workflow does
This AI workflow has 9 nodes and runs when someone submits an n8n form (“Portfolio Risk Analyzer”). Along the way it connects Google Sheets, OpenAI Chat Model and Gmail.
How it runs
Trigger: When someone submits an n8n form (“Portfolio Risk Analyzer”).
- 2. Sheets — Load Portfolio Holdings (Google Sheets): get many
- 3. Aggregate — Bundle All Holdings (Aggregate): combines items into one
- 4. Code — Calculate Portfolio Risk Metrics (Code): runs custom JavaScript code
- 5. AI Agent — Generate Risk Report (AI Agent): runs an AI agent, with model: OpenAI Chat Model
- 6. Code — Build HTML Risk Report Email (Code): runs custom JavaScript code
- 7. Gmail — Send Risk Report (Gmail): uses Gmail
- 8. Sheets — Log Analysis for Audit (Google Sheets): append
Services it uses
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in 5. AI Agent — Generate Risk Report (v1.9): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) 5. AI Agent — Generate Risk Report (v1.9) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (7)
- n8n Form Trigger
n8n-nodes-base.formTrigger - Google Sheets
n8n-nodes-base.googleSheets - Aggregate
n8n-nodes-base.aggregate - Code
n8n-nodes-base.code - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Gmail
n8n-nodes-base.gmail
From the author
Quick overview This workflow collects a portfolio request via an n8n Form, loads holdings from Google Sheets, calculates portfolio risk and concentration metrics, generates an HTML risk narrative with OpenAI, then emails the full report via Gmail and appends…