Automate Google Stock Earnings Analysis with n8n RAG Workflow

This n8n workflow automates the analysis of Google’s last three quarters earnings reports using a Retrieval-Augmented Generation (RAG) approach. By integrating Google Sheets, Drive, Pinecone, and AI tools, it saves hours of manual report compilation and provides precise financial insights quickly.
agent
vectorStorePinecone
googleDocs
+10
Workflow Identifier: 1765
NODES in Use: manualTrigger, googleSheets, googleDrive, documentDefaultDataLoader, textSplitterRecursiveCharacterTextSplitter, embeddingsGoogleGemini, vectorStorePinecone, splitInBatches, agent, googleDocs, lmChatOpenAi, toolVectorStore, lmChatGoogleGemini

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Automation Does

This workflow reads earnings report PDFs from Google Drive using links in Google Sheets.

It turns PDFs into text chunks, makes semantic embeddings with Google Gemini, and saves them in Pinecone.

When a user asks a question, it finds matching text and runs an AI analysis to make a clear report.

The final report goes into Google Docs for easy use and sharing.

This saves many hours of manual work by giving detailed financial reports fast and accurate.


Tools and Services Used

  • Google Sheets: Holds links to earnings report PDFs.
  • Google Drive: Stores the earnings report PDF files.
  • Google Docs: Saves the AI generated reports.
  • Google Gemini (PaLM) API: Creates semantic text embeddings and runs AI models.
  • Pinecone API: Vector database for searching similar document parts.
  • n8n Automation Platform: Runs and connects all nodes in one workflow.

Inputs, Process, and Output

Inputs

  • List of PDF URLs in Google Sheets.
  • Pooled earnings reports files in Google Drive.

Processing Steps

  • Download each PDF from Google Drive.
  • Convert PDF to plain text.
  • Split text into smaller chunks.
  • Create embeddings with Google Gemini.
  • Save embeddings to Pinecone vector store.
  • On query, use vector search to find related text chunks.
  • Run AI agent with fetched data to generate analysis.

Output

  • Formatted financial report for last three quarters saved in Google Docs.

Beginner Step-by-Step: How to Use This Workflow in n8n

Step 1: Import the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Open n8n editor where the workflow will be run.
  3. Use the Import from File option in n8n to bring the downloaded workflow into the editor.

Step 2: Configure Credentials and IDs

  1. Add your Google Sheets, Drive, and Docs OAuth2 credentials inside n8n.
  2. Set up Google Gemini (PaLM) API key in the embedding and AI nodes.
  3. Enter your Pinecone API Key and ensure the index name matches, usually ‘company-earnings’.
  4. Update any placeholders such as Google Sheet IDs, Drive folder IDs, Docs URLs, or email addresses if the workflow uses those.

Step 3: Test the Workflow

  1. Manually trigger the workflow in n8n to test it.
  2. Check if PDFs download, text converts, embeddings create, and AI generates a report.
  3. Review the Google Doc for the generated report.

Step 4: Activate for Production

  1. Enable the workflow by turning it on inside n8n.
  2. Set any required schedules or webhook triggers for automatic run if needed.
  3. Monitor workflow runs and logs regularly.

If interested in more control over environment and data privacy, consider self-host n8n on your own server.


Customization Ideas

  • Add more earnings reports in the Google Sheets watchlist to analyze more data.
  • Change the AI system prompt to focus on other financial metrics like cash flow.
  • Use different Google Gemini embedding models for different speeds or detail.
  • Expand workflow to send the Google Docs report by email or Slack with extra nodes.
  • Add charts manually in Google Docs using data from the report outputs.

Troubleshooting

Vector Store Insert Failed Due to Missing Index

Cause: Pinecone index named ‘company-earnings’ does not exist or is not accessible.

Solution: Create this index in Pinecone dashboard and check API key permissions.

Failed to Download File from Google Drive

Cause: File URL incorrect or OAuth2 user lacks permission.

Solution: Verify file URL correctness and ensure OAuth2 credentials have full access.

AI Agent Generates Incomplete or Irrelevant Reports

Cause: System prompt with missing or unclear details.

Solution: Improve AI system message with exact instructions and what financial areas to focus on.


Pre-Production Checklist

  • Google Sheets contains all correct PDF URLs accessible to n8n credentials.
  • All PDFs exist in Google Drive and have correct sharing settings.
  • Pinecone index ‘company-earnings’ is created and reachable.
  • Test Google Gemini embeddings on sample text to avoid API limits.
  • Run manual trigger end-to-end and check Google Docs report.
  • Backup Google Sheets and Google Docs regularly to prevent data loss.

Deployment Guide

Activate the workflow inside n8n and add all required API Keys and OAuth credentials.

Use manual trigger first to check the workflow works fully.

Set schedules or webhook triggers as needed to automate report generation later.

Watch logs to troubleshoot any failures and improve AI prompts or input data as necessary.


Summary of Workflow Benefits and Results

✓ Saves many hours of manual financial data processing.

✓ Generates accurate and detailed earnings report fast.

✓ Uses clear, human-like AI analysis with specific financial focus.

✓ Stores and searches text data efficiently with Pinecone vector DB.

✓ Outputs professional formatted reports inside Google Docs.

→ Streamlined earnings report analysis from PDF to report.

→ Reduces human errors by automating data extraction and summarization.

→ Flexible for multiple companies or broader financial documents.


Frequently Asked Questions

Yes, by adding URLs of other companies’ PDFs in the Google Sheets watchlist and uploading those PDFs to Google Drive, the workflow can process any company’s earnings reports.
This error happens when the Pinecone index named ‘company-earnings’ does not exist or is not accessible. Creating the index in the Pinecone dashboard with correct permissions fixes this.
Improving the system prompt with detailed instructions and specifying exactly which financial metrics to analyze helps the AI Agent generate more relevant and complete reports.
No, using Google Gemini (PaLM) API and Pinecone vector database incurs costs based on usage. Monitoring API quotas and limits is recommended to avoid unexpected charges.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free