Stock News Morning Report Agent
Every weekday at 8 AM: reads your stock watchlist from Google Drive, loops through each stock calling Gemini AI for the latest 48-hour news, builds a clean HTML report, and emails it to your inbox — before you even open your laptop.
Architecture
0 8 * * 1-5 (weekdays 8 AM) · AI Model: Google Gemini 2.5 FlashSample Report Email
What You Need
| What | Where to get it | Time |
|---|---|---|
| Docker Desktop | docker.com/products/docker-desktop | 5 min |
| Google Account (Gmail + Drive) | Already have one | — |
| Gemini API Key | aistudio.google.com/apikey | 2 min |
| Google OAuth Credentials | console.cloud.google.com | 10 min |
| Stock list Excel file (.xlsx) | Create it yourself | 2 min |
Step-by-Step Setup
Install Docker & Run n8n
New to Docker? Follow the full Docker & n8n Setup Guide →
Create Your Stock List Excel File
Column A1 must be exactly StockName, then list one stock per row (e.g. Bajaj Finance, Tata Motors, Reliance Industries). Save as .xlsx and upload to Google Drive.
Get a Gemini API Key
Go to aistudio.google.com/apikey and create a key.
Set Up Google OAuth for Drive + Gmail
Create a Google Cloud project, enable both the Google Drive API and Gmail API, configure the OAuth consent screen (add yourself as test user), then create an OAuth Client ID with redirect URI:
Import the Workflow
In n8n: + → New Workflow → ... → Import from file → select stock_news_morning_report.json. All 9 nodes load connected.
Connect Google Drive & Gmail
On the Drive node, connect via OAuth and switch File to "From List" to select your stock sheet. On the Gmail node, connect the same credential and fill in To / Subject / Message (already set to {{ $json.html }}).
Add Your Gemini API Key
On the Ask Gemini for News node's Query Parameters, paste your key as the key value.
Save, Test & Publish
Save, click Execute workflow to test immediately without waiting for 8 AM, then click Publish to activate the weekday schedule.
Configuration, Limits & Troubleshooting
Configuration Reference
| What to change | Where |
|---|---|
| Schedule time | "Every Weekday 8AM" node → cron expression |
| Recipient email | "Send Morning Report Email" node → To |
| Delay between stocks | "Wait" node → Wait Amount |
| Gemini model | "Ask Gemini for News" node → URL |
⚠️ Gemini Free Tier Limits
| Limit | Value |
|---|---|
| Requests per minute | 15 |
| Daily limit | ~500 requests (varies) |
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
Access blocked | Not a test user | OAuth Consent Screen → Audience → add your Gmail |
Quota exceeded | Too many requests | Wait 2 minutes, reduce list to 5 stocks for testing |
API key not valid | Wrong key or extra spaces | Copy fresh from aistudio.google.com |
| Email not received | Gmail node not fully configured | Check To, Subject, Message fields |
Ideas to Extend
- Add stock price and P/E ratio via a market data API
- Only email when a stock has negative sentiment
- Deliver via WhatsApp instead of email
- Group stocks by sector (Banking, IT, Auto) in the report