📈 Agent 5 of 5 · Advanced

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.

Advanced 9 Nodes Scheduled Trigger Google Drive Gemini 2.5 Flash Gmail OAuth
How It Works

Architecture

[ Schedule Trigger ] Fires every weekday at 8:00 AM ↓ [ Google Drive Node ] Downloads your stock watchlist Excel file ↓ [ Extract from File Node ] Reads each row from the Excel sheet ↓ [ Normalize Stock Rows — Code Node ] Cleans up the data, extracts stock names ↓ [ Wait Node ] Waits 5 seconds between each stock (avoids Gemini rate limits) ↓ [ HTTP Request → Gemini AI ] For each stock: "What is the latest news about [Stock]?" ↓ [ Extract News Summary — Code Node ] Pulls just the text response from Gemini's JSON ↓ [ Build HTML Report — Code Node ] Combines all stocks into one clean HTML email table ↓ [ Gmail Node ] Sends the report to your inbox
✅ Total nodes: 9  ·  Trigger: 0 8 * * 1-5 (weekdays 8 AM)  ·  AI Model: Google Gemini 2.5 Flash

Sample Report Email

📈 Morning Stock News Report Wednesday, 22 July 2026 Stock | News Summary ------------------------|----------------------------------------------- Bajaj Finance | No major company-specific news in the last 48 | hours. Analysts maintain Buy ratings. Sentiment: | Neutral to cautiously positive. Reliance Industries | RIL announces new partnership in green energy | space. Share price up 1.2% on strong volumes. | Sentiment: Positive. HDFC Bank | Q1 results beat expectations. NIM stable at | 4.1%. FIIs buying on dips. Sentiment: Positive.
Before You Start

What You Need

WhatWhere to get itTime
Docker Desktopdocker.com/products/docker-desktop5 min
Google Account (Gmail + Drive)Already have one—
Gemini API Keyaistudio.google.com/apikey2 min
Google OAuth Credentialsconsole.cloud.google.com10 min
Stock list Excel file (.xlsx)Create it yourself2 min
Build Guide

Step-by-Step Setup

1

Install Docker & Run n8n

docker run -d \ --name n8n \ --restart unless-stopped \ -p 5678:5678 \ -v n8n_data:/home/node/.n8n \ docker.n8n.io/n8nio/n8n

New to Docker? Follow the full Docker & n8n Setup Guide →

2

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.

Start with 5-6 stocks if using the Gemini free tier, to avoid rate limits.
3

Get a Gemini API Key

Go to aistudio.google.com/apikey and create a key.

4

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:

http://localhost:5678/rest/oauth2-credential/callback
5

Import the Workflow

In n8n: + → New Workflow → ... → Import from file → select stock_news_morning_report.json. All 9 nodes load connected.

6

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 }}).

7

Add Your Gemini API Key

On the Ask Gemini for News node's Query Parameters, paste your key as the key value.

8

Save, Test & Publish

Save, click Execute workflow to test immediately without waiting for 8 AM, then click Publish to activate the weekday schedule.

Reference

Configuration, Limits & Troubleshooting

Configuration Reference

What to changeWhere
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

LimitValue
Requests per minute15
Daily limit~500 requests (varies)
Start with 5-6 stocks when testing. The built-in 5-second Wait node spaces out requests. For larger watchlists, enable billing on Google Cloud (~₹0.50/month).

Troubleshooting

ErrorCauseFix
Access blockedNot a test userOAuth Consent Screen → Audience → add your Gmail
Quota exceededToo many requestsWait 2 minutes, reduce list to 5 stocks for testing
API key not validWrong key or extra spacesCopy fresh from aistudio.google.com
Email not receivedGmail node not fully configuredCheck To, Subject, Message fields
Go Further

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
Built With

Tech Stack

n8n Google Gemini 2.5 Flash Google Drive API Gmail API Docker