AutomationFlowsAI & RAG › Generate Multi-quarter Earnings Reports with Google Workspace, Gemini and…

Generate Multi-quarter Earnings Reports with Google Workspace, Gemini and…

Original n8n title: Generate Multi-quarter Earnings Reports with Google Workspace, Gemini and Pinecone

ByRedowan Ahmed Farhan @redowanfarhan on n8n.io

This workflow ingests quarterly earnings PDFs listed in Google Sheets from Google Drive into a Pinecone vector index using Google Gemini embeddings, then uses an OpenAI-powered agent with Pinecone retrieval to generate a markdown earnings-trend report and save it into Google…

Event trigger★★★★☆ complexityAI-powered19 nodesPinecone Vector StoreGoogle Gemini EmbeddingsDocument Default Data LoaderText Splitter Recursive Character Text SplitterAgentTool Vector StoreGoogle Gemini ChatOpenAI Chat
AI & RAG Trigger: Event Nodes: 19 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #17560 — we link there as the canonical source.

This workflow follows the Agent → Documentdefaultdataloader recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "NeT9JiytGlgek6g0",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "RAG Workflow For Stock Earnings Report Analysis",
  "tags": [],
  "nodes": [
    {
      "id": "318fbc40-0e86-4f39-91ed-e3f9be55cc21",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2128,
        1184
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 1620,
        "content": "## \ud83d\udcca RAG Workflow For Stock Earnings Report Analysis\n\nAn analyst-style agent that ingests a company's quarterly earnings PDFs (10-Qs, earnings releases) from Google Drive, embeds them into a vector store, and generates a markdown financial report highlighting trends and outliers across the last several quarters \u2014 saving the output straight into a Google Doc.\n\n**Perfect for:** investors, analysts, or finance teams who want a repeatable way to turn a stack of quarterly filings into a structured \"what changed and why\" report, without manually re-reading each PDF every quarter.\n\n---\n\n## How it works\n\n1. **When clicking 'Test workflow'** \u2014 Starts the run.\n2. **List Of Files To Load (Google Sheets)** \u2014 Reads a watchlist sheet containing Google Drive file URLs for each earnings PDF.\n3. **Loop Over Items** \u2014 Processes the file list one document at a time (Split In Batches).\n4. **Download File From Google Drive** \u2014 Fetches each PDF binary.\n5. **Pinecone Vector Store** \u2014 Inserts each document into the `company-earnings` index.\n6. **Embeddings Google Gemini** \u2014 Generates the embeddings used to store each chunk.\n7. **Default Data Loader** \u2014 Loads the PDF binary for chunking. *(feeds the Pinecone insert)*\n8. **Recursive Character Text Splitter** \u2014 Splits each document into chunks before loading.\n9. **AI Agent** \u2014 Triggered by the same manual trigger; runs a fixed prompt asking for a markdown report on the company's last 3 quarters, focused on differences, trends, and outliers.\n10. **OpenAI Chat Model** \u2014 Powers the AI Agent's own reasoning.\n11. **Vector Store Tool** \u2014 A tool the agent calls to retrieve relevant earnings passages.\n12. **Pinecone Vector Store (Retrieval)** \u2014 Backs the Vector Store Tool with semantic search over the ingested filings.\n13. **Embeddings Google Gemini (retrieval)** \u2014 Generates query embeddings for retrieval.\n14. **Google Gemini Chat Model1** \u2014 Language model used by the Vector Store Tool.\n15. **Save Report to Google Docs** \u2014 Inserts the agent's generated markdown report into a target Google Doc.\n\n---\n\n## Setup (~30 minutes)\n\n1. **Google Cloud / Vertex AI** \u2014 Add a Google AI Studio API key for *Embeddings Google Gemini*, *Embeddings Google Gemini (retrieval)*, and *Google Gemini Chat Model1*.\n2. **OpenAI** \u2014 Add your API key in the *OpenAI Chat Model* node.\n3. **Pinecone** \u2014 Create an index named `company-earnings` and add API credentials to *Pinecone Vector Store* and *Pinecone Vector Store (Retrieval)*.\n4. **Google Sheets** \u2014 Add OAuth2 credentials to *List Of Files To Load (Google Sheets)* and point it at your own watchlist spreadsheet with a `File URL` column.\n5. **Google Drive** \u2014 Add OAuth2 credentials to *Download File From Google Drive*.\n6. **Google Docs** \u2014 Add OAuth2 credentials to *Save Report to Google Docs* and replace the hardcoded `documentURL` with your own target document.\n7. **Update the prompt per company** \u2014 *AI Agent*'s user prompt and system message are hardcoded to analyze Google's earnings; rewrite both for whichever company you've loaded.\n> There's no incremental/dedupe logic on ingestion \u2014 remove already-ingested rows from the watchlist before re-running, or accept duplicate embeddings."
      },
      "typeVersion": 1
    },
    {
      "id": "911ac266-8688-4f6a-adfd-383824628efd",
      "name": "Section: Trigger & Data Intake",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2528,
        752
      ],
      "parameters": {
        "color": 5,
        "width": 836,
        "height": 372,
        "content": "## 1\ufe0f\u20e3 Trigger & Data Intake\n\n**When clicking 'Test workflow'** starts the run. **List Of Files To Load (Google Sheets)** reads the watchlist of earnings PDFs, **Loop Over Items** processes that list one file at a time, and **Download File From Google Drive** fetches each PDF binary for ingestion."
      },
      "typeVersion": 1
    },
    {
      "id": "2901565a-faf1-4c53-83d8-03557bd5bb3f",
      "name": "Section: Indexing & Embedding Pipeline",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3408,
        688
      ],
      "parameters": {
        "color": 3,
        "width": 660,
        "height": 796,
        "content": "## 2\ufe0f\u20e3 Indexing & Embedding Pipeline\n\nEach downloaded PDF flows into **Pinecone Vector Store** in insert mode, which is fed by **Default Data Loader** (parses the binary), **Recursive Character Text Splitter** (chunks the text), and **Embeddings Google Gemini** (generates the vectors). The loop repeats until every watchlist file has been embedded into the `company-earnings` index."
      },
      "typeVersion": 1
    },
    {
      "id": "8c3316a0-0d32-46aa-8704-73af222b7fb3",
      "name": "Section: AI Agent, Retrieval & Reporting",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2768,
        1536
      ],
      "parameters": {
        "color": 6,
        "width": 1404,
        "height": 960,
        "content": "## 3\ufe0f\u20e3 AI Agent, Retrieval & Reporting\n\nThe **AI Agent**, powered by **OpenAI Chat Model**, runs a fixed prompt asking for a trend-and-outlier report on the company's last three quarters. It calls the **Vector Store Tool** to search **Pinecone Vector Store (Retrieval)**, backed by **Embeddings Google Gemini (retrieval)** and **Google Gemini Chat Model1**, then **Save Report to Google Docs** writes the finished markdown report into a target Google Doc."
      },
      "typeVersion": 1
    },
    {
      "id": "aa88ca61-b567-4ff4-a8a7-17ce9af5ee49",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        3536,
        896
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "company-earnings",
          "cachedResultName": "company-earnings"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6d703289-40c0-4197-86a0-7fa3f3e715a6",
      "name": "Embeddings Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        3456,
        1168
      ],
      "parameters": {
        "modelName": "models/text-embedding-004"
      },
      "typeVersion": 1
    },
    {
      "id": "bab5b210-4c96-4c2e-89c6-257acd5bf35b",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        3680,
        1152
      ],
      "parameters": {
        "loader": "pdfLoader",
        "options": {},
        "dataType": "binary"
      },
      "typeVersion": 1
    },
    {
      "id": "2ab4c4d4-3020-4fe1-ae3e-1d121e0057f9",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        3712,
        1328
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "e40e6694-7868-4ab2-911c-87bdaad44b90",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2896,
        912
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "610e8440-5346-4ece-b632-57e449f16ce7",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        2864,
        1712
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "87fc5734-7b9e-44c8-b31f-a8b3ff13d557",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        3184,
        1712
      ],
      "parameters": {
        "text": "Give me a report on Google's last 3 quarter earnings. Format it in markdown. Focus on the differences and trends. Spot any outliers.",
        "options": {
          "systemMessage": "You are a highly skilled financial analyst specializing in analyzing Google's (Alphabet Inc.) financial performance. You have access to two powerful tools:\n\n1. **Vector Store Tool:** This tool allows you to retrieve relevant information from the past three quarters of Google's earnings reports (PDF documents). The documents have been processed and stored as embeddings in a vector database, enabling semantic search. Use this tool to find specific information related to revenue, expenses, profits, losses, growth, key metrics, management commentary, and any other relevant financial data.\n2. **Google Docs Tool:** This tool allows you to create, edit, and format Google Docs. Use this tool to save your findings into a Google Doc.\n\nYour task is to answer user queries related to Google's financial performance based on the last three quarters' earnings reports. When a user asks a question:\n\n1. **Understand the User's Intent:** Carefully analyze the user's query to determine what specific financial information they are seeking. Identify keywords, timeframes (e.g., \"previous quarter\"), and the type of analysis requested (e.g., trend analysis, comparison, explanation).\n2. **Retrieve Relevant Information:** Use the Vector Store Tool to search for and retrieve the most relevant text passages from the earnings reports that address the user's query. Retrieve multiple, diverse chunks to ensure comprehensive coverage.\n3. **Synthesize and Analyze:** Analyze the information from the retrieved text chunks. Identify key trends, patterns, and insights related to the user's query.\n4. **Generate Report in Google Docs:** Use the Google Docs Tool to create a new Google Doc (or append to an existing one, if specified by the user). Structure the report with clear headings, bullet points, and concise paragraphs. Include the following in your report as appropriate:\n * **Executive Summary:** A brief overview of the key findings.\n * **Revenue Analysis:** Report on revenue figures, growth rates, and key revenue drivers.\n * **Expense Analysis:** Report on major expense categories and their impact on profitability.\n * **Profitability Analysis:** Discuss net income, profit margins, and earnings per share (EPS).\n * **Key Metrics:** Include other relevant financial metrics mentioned in the reports (e.g., operating income, cash flow, segment performance).\n * **Management Commentary:** Summarize any relevant insights or explanations provided by Google's management in the earnings calls or reports.\n * **Trend Analysis:** Compare the current quarter's performance to the previous two quarters, highlighting significant changes or trends.\n * **Visualizations:** If possible, use the Google Docs tool to insert basic charts or tables to visually represent the data. (You might need to guide the user on how to do this if the tool has limitations.)\n5. **Cite Sources:** Clearly indicate the source of your information (e.g., \"Q2 2023 Earnings Report\") for each data point or analysis.\n6. **Maintain a Professional Tone:** Write in a clear, concise, and objective tone, as expected of a financial analyst. Avoid speculation or making unsubstantiated claims.\n\nYour ultimate goal is to provide the user with a well-structured, informative, and accurate financial report based on the data available in the last three quarters of Google's earnings reports.\nSave the report in as a Google Doc using the available tool!"
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "3aa97b04-aaf9-4f47-b106-56d0b52d8494",
      "name": "Vector Store Tool",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        3584,
        1936
      ],
      "parameters": {
        "name": "company_financial_earnings_data_tool",
        "description": "Retrieve information about the last 3 quarters of Google Earnings"
      },
      "typeVersion": 1
    },
    {
      "id": "958babd5-d539-4d6d-bab0-a2bbab69634e",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        3840,
        2144
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-exp"
      },
      "typeVersion": 1
    },
    {
      "id": "df13ce15-4779-435c-94af-c226eb27e627",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        3056,
        1936
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "b120e000-c57e-428b-a6f6-139c1db58029",
      "name": "Pinecone Vector Store (Retrieval)",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        3472,
        2160
      ],
      "parameters": {
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "company-earnings",
          "cachedResultName": "company-earnings"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e6fd84d5-7f15-4cfa-8d03-5fe29fc6efb6",
      "name": "Save Report to Google Docs",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        3680,
        1712
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ $json.output }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "REPLACE_WITH_DOCUMENT_ID"
      },
      "typeVersion": 2
    },
    {
      "id": "245d7e62-1d32-44d4-acd8-56c8243d2b4a",
      "name": "Embeddings Google Gemini (retrieval)",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        3456,
        2336
      ],
      "parameters": {
        "modelName": "models/text-embedding-004"
      },
      "typeVersion": 1
    },
    {
      "id": "3528ed40-cf0b-4031-9b96-bf7288795ac1",
      "name": "List Of Files To Load (Google Sheets)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2624,
        912
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1476836405,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_SPREADSHEET_ID/edit#gid=1476836405",
          "cachedResultName": "GOOG"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "REPLACE_WITH_SPREADSHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/REPLACE_WITH_SPREADSHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Watchlist"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "2909d6c6-c839-4820-a2d3-4a96a062427c",
      "name": "Download File From Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3168,
        912
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('List Of Files To Load (Google Sheets)').item.json['File URL'] }}"
        },
        "options": {
          "fileName": "={{ $('List Of Files To Load (Google Sheets)').item.json['10Q'] }}"
        },
        "operation": "download"
      },
      "typeVersion": 3
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "404f245b-0075-4201-9ce5-6e550e25cf88",
  "nodeGroups": [],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Save Report to Google Docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Download File From Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Download File From Google Drive": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store (Retrieval)": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini (retrieval)": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store (Retrieval)",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "List Of Files To Load (Google Sheets)": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow ingests quarterly earnings PDFs listed in Google Sheets from Google Drive into a Pinecone vector index using Google Gemini embeddings, then uses an OpenAI-powered agent with Pinecone retrieval to generate a markdown earnings-trend report and save it into Google…

Source: https://n8n.io/workflows/17560/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Api Schema Extractor. Uses manualTrigger, httpRequest, splitOut, textSplitterRecursiveCharacterTextSplitter. Event-driven trigger; 88 nodes.

HTTP Request, Text Splitter Recursive Character Text Splitter, Document Default Data Loader +9
AI & RAG

Wait Splitout. Uses manualTrigger, httpRequest, splitOut, textSplitterRecursiveCharacterTextSplitter. Event-driven trigger; 88 nodes.

HTTP Request, Text Splitter Recursive Character Text Splitter, Document Default Data Loader +9
AI & RAG

This workflow automates the process of discovering and extracting APIs from various services, followed by generating custom schemas. It works in three distinct stages: research, extraction, and schema

HTTP Request, Text Splitter Recursive Character Text Splitter, Document Default Data Loader +9
AI & RAG

This advanced n8n workflow automates the full lead enrichment, qualification, and personalized outreach process tailored specifically for the B2B real estate sector. Integrating top platforms like Api

N8N Nodes Fillout, OpenAI Chat, Pinecone Vector Store +11
AI & RAG

This workflow ingests onboarding documents from Google Drive into an in-memory vector store with Google Gemini embeddings, then runs a multi-channel onboarding chatbot powered by Groq, sends role-base

Google Drive, In-Memory Vector Store, Google Gemini Embeddings +14