Financial Report Generation using RAG, Gemini, and Pinecone - n8n Workflow

Use this powerful n8n workflow to automate RAG-based financial analysis. Load earnings report PDFs into a Pinecone vector database and leverage a Gemini AI Agent to generate detailed reports in Google Docs.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Financial Analysts needing automated, rapid summarization and comparison of quarterly earnings reports.
Data Scientists and ML Engineers building complex RAG pipelines in a low-code environment like n8n.
Businesses requiring contextualized information extraction from large sets of proprietary PDF documents.
Users leveraging n8n templates for advanced LangChain integration.

Overview

For financial analysts, researchers, and automation specialists, manually processing multiple quarterly earnings reports (often hundreds of pages long) is tedious and time-consuming. This specialized n8n workflow solves this by creating a robust Retrieval-Augmented Generation (RAG) system.

This n8n automation first orchestrates the ingestion of Google Drive-hosted PDF reports, splitting them, embedding them using Google Gemini, and storing the vectors in Pinecone. Once indexed, an advanced AI Agent, configured as a specialized financial analyst, uses the RAG knowledge base to answer complex queries about trends, outliers, and comparisons across quarters, delivering the final, professionally formatted report directly into Google Docs. This structure ensures accurate, contextualized analysis powered by a sophisticated n8n node configuration.

How it Works

This n8n workflow operates in two main phases: Data Ingestion and Report Generation.

Phase 1: Data Ingestion (Training the RAG Knowledge Base)


  1. The process begins by reading a list of financial document URLs from a List Of Files To Load (Google Sheets) n8n node.

  2. The Loop Over Items n8n node iterates over each document listed in the sheet.

  3. The Download File From Google Drive n8n node fetches the specified PDF binary file.

  4. The Default Data Loader processes the PDF binary.

  5. The Recursive Character Text Splitter breaks the document into smaller, embeddable chunks.

  6. The Embeddings Google Gemini n8n node converts these text chunks into vectors.

  7. Finally, the Pinecone Vector Store (in insert mode) uploads these vectors to the dedicated 'company-earnings' index, making the data searchable.

Phase 2: AI Agent Report Generation


  1. The analysis is initiated by the When clicking ‘Test workflow’ n8n trigger.

  2. The central AI Agent n8n node is activated with the query: 'Give me a report on Google's last 3 quarter earnings...' The agent acts as a financial analyst, utilizing its pre-configured tools.

  3. The agent accesses the Vector Store Tool (RAG setup), which performs a similarity search against the Pinecone index using the Embeddings Google Gemini (retrieval) model and synthesizes the context via the Google Gemini Chat Model1.

  4. The agent uses the retrieved context and its system prompt instructions to synthesize a detailed financial analysis, focusing on trends and outliers.

  5. The final output is passed to the Save Report to Google Docs n8n node, which inserts the markdown-formatted financial report into the designated Google Document.

Installation Guide

Essential Setup and Configuration


  1. Prerequisite Accounts: You need accounts and API keys for Google AI (Gemini), Pinecone, and OAuth2 credentials for Google Sheets, Drive, and Docs.

  2. Pinecone Setup: Create a Pinecone index named company-earnings before running the ingestion phase of the n8n workflow.

  3. Credential Configuration: In your n8n environment, configure credentials for: Google Sheets OAuth2, Google Drive OAuth2, Google Docs OAuth2, Google Gemini(PaLM) Api, and Pinecone API.

  4. Importing the n8n workflow: Copy the provided JSON and import it into your n8n instance.

  5. Google Sheet Setup: Update the List Of Files To Load (Google Sheets) n8n node to point to your specific spreadsheet containing the PDF file URLs.

  6. Google Docs Setup: Update the Save Report to Google Docs n8n node with the URL or ID of the Google Doc where you want the final analysis report to be saved.

  7. Initial Run (Ingestion): Execute the initial chain (from Google Sheets to Pinecone Vector Store) to load your financial data into the RAG system. This step populates the knowledge base used by the subsequent n8n node analysis.

  8. Final Run (Analysis): Activate the AI Agent chain via the manual n8n trigger to generate the report.

Node Details

When clicking ‘Test workflow’ (n8n trigger):
Function: Manually starts the report generation process.
Key Configuration: Standard manual n8n trigger used for testing and immediate execution.
List Of Files To Load (Google Sheets) (n8n node):
Function: Serves as the initial data source, pulling metadata (specifically File URLs) for the earnings reports from a designated Google Sheet.
Key Configuration: Links to a specific Google Sheet Document ID and Sheet Name (e.g., 'GOOG').
Download File From Google Drive (n8n node):
Function: Downloads the actual binary PDF files using the URL dynamically retrieved from the Google Sheets n8n node output.
Key Configuration: Operation set to 'download'; File ID derived dynamically using an expression linking back to the Google Sheets data.
Pinecone Vector Store (n8n node):
Function: The primary vector database interaction point. Used in two distinct chains: one for inserting new vectors (ingestion) and one for retrieval (RAG query).
Key Configuration: Index name: company-earnings.
AI Agent (n8n node):
Function: The core decision-making and generation component of this n8n workflow. It uses a sophisticated system prompt defining its role as a financial analyst and orchestrates the use of internal tools (the RAG retrieval chain).
Key Configuration: Custom prompt defining the comprehensive financial analysis task; linked to the Vector Store Tool and uses an OpenAI Chat Model for generation.
Vector Store Tool (n8n node):
Function: Provides the AI Agent with access to the RAG knowledge base (Pinecone) via a specialized retrieval chain, ensuring all answers are grounded in the provided earnings reports.
Key Configuration: Description: 'Retrieve information about the last 3 quarters of Google Earnings'.
Save Report to Google Docs (n8n node):
Function: The final action in this n8n workflow, taking the structured output from the AI Agent and writing it into a pre-existing Google Doc.
* Key Configuration: Operation 'update'; content set to the agent's markdown output ({{ $json.output }}).

Related n8n Workflows

Free

Nodes: 14 Nodes
Updated: December 26 2025
View all
Created by

Full-stack developer with 5+ years streamlining healthcare processes. Proficient in NodeJS, VueJS, MongoDB, PostgreSQL, Kubernetes, and n8n. Ready to optimize your workflows – book a consult via my link.

Featured*