Talk to Your Google Sheets Data Using OpenAI Chat Agent

This workflow transforms a Google Sheet into a live, conversational database. Using an AI agent powered by OpenAI's GPT-4.1-nano model, you can ask natural language questions about your spreadsheet data and receive accurate, context-aware answers — without writing any SQL or formulas. The agent can handle queries like total campaign spend, per-channel breakdowns, month-over-month trends, and cost-per-lead calculations.

Workflow Steps

Node-by-Node Breakdown

  1. Chat with Your Data (Chat Trigger) — This is the entry point of the workflow. It provides a chat interface (webhook) where users type their questions. No authentication is required to trigger the webhook; access can be secured at the workflow level.

  2. Memory (Buffer Window Memory) — Stores recent conversation history so the AI can reference previous exchanges. The buffer window keeps the last few messages to maintain context without excessive token use. No authentication required.

  3. OpenAI Chat Model (OpenAI GPT-4.1-nano) — The language model that processes user questions and generates answers. Uses API Key auth (you must provide an OpenAI API key). Parameters: model = gpt-4.1-nano, no additional options configured.

  4. Talk to Your Data (AI Agent) — The core agent that orchestrates the conversation. It receives user input, decides which tool to call (only the Google Sheets tool is available), and returns answers. Uses API Key auth (uses the same OpenAI credential as the model). Parameters include a system message: "Google Sheets Ask-… You are Ask-… Answer questions using Google Sheets ONLY via the tool below. Be precise and conservative. There is only one dataset. Don't ask what dataset it is. Use the data tool to answer the question."

  5. Analyze Data (Google Sheets Tool) — The tool the agent calls to read spreadsheet data. Uses OAuth2 authentication (Google Sheets). Parameters: document ID = 1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4 ("Sample Marketing Data - n8n"), sheet name = "Data" (gid: 365710158). No additional options set.

  6. Sticky Notes (Information Only) — Provide setup instructions and tips. Not executable nodes.

Setup Instructions

Before using this workflow, you need:

  • OpenAI Account — Visit OpenAI API Keys to generate an API key. Make sure you have billing set up at OpenAI Billing and have credits available.
  • Google Account — You need access to a Google Sheet. The sample uses a specific sheet, but you can point it to any sheet with a similar structure: first row = column headers, rows 2–100 = data.

To configure:

  1. In the OpenAI Chat Model node, create an OpenAI credential with your API key.
  2. In the Analyze Data node, create a Google Sheets OAuth2 credential (select your Google account and authorize access).
  3. Update the Document ID and Sheet Name to match your own Google Sheet.
  4. Optionally update the system message in the Talk to Your Data agent if you want to change the assistant's personality or instructions.

Use Cases and Variations

This workflow is perfect for:

  • Marketing teams wanting instant answers about campaign performance, spend, and ROI.
  • Sales operations analyzing pipeline data, deal stages, or conversion metrics.
  • Small business owners asking questions about inventory, sales, or customer data without learning SQL.

Adaptations:

  • Replace Google Sheets with another data source tool (e.g., Airtable, Notion, PostgreSQL, MySQL) by swapping the "Analyze Data" node.
  • Add more tools to the agent (e.g., a web search tool, a calculator) to expand its capabilities.
  • Change the model to GPT-4o or GPT-3.5-turbo for faster/cheaper responses.
  • Add a Slack or Webhook trigger instead of the chat trigger for a different user interface.
11 nodesmanual triggerData
Google Sheets ToolLm Chat Open AISticky NoteAgentMemory Buffer Window

Workflow JSON

{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "5b054044-5814-47aa-99b4-0a9c5a601bad",
      "name": "Analyze Data",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        784,
        1328
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 365710158,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4/edit#gid=365710158",
          "cachedResultName": "Data"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UDWt0-Z9fHqwnSNfU3vvhSoYCFG6EG3E-ZewJC_CLq4/edit?usp=drivesdk",
          "cachedResultName": "Sample Marketing Data - n8n"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "a6869994-77e8-4f5d-916c-cc40f0b5ab7e",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        224,
        1312
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-nano",
          "cachedResultName": "gpt-4.1-nano"
        },
        "options": {}
      },
// ... truncated (copy to see full JSON)

How to Import This Workflow

  1. 1Copy the workflow JSON above using the Copy Workflow JSON button.
  2. 2Open your n8n instance and go to Workflows.
  3. 3Click Import from JSON and paste the copied workflow.

Don't have an n8n instance? Start your free trial at n8nautomation.cloud

Related Templates

AI-Powered CV Scanner with Google Sheets & Gemini

Overview This workflow automates the initial screening of job applicants by combining a web form, AI-powered CV analysis, and Google Sheets. When a candidate submits their application (name, email, and CV PDF), the workflow instantly extracts the text from the PDF using Mistral OCR, then sends it to Google Gemini for evaluation against a predefined job description. The AI returns a qualification score (0.0 to 1.0) and a detailed explanation, which are then logged alongside the candidate's details in a Google Sheet. This eliminates manual CV review, speeds up your hiring pipeline, and ensures every applicant is evaluated consistently. Workflow Steps Application Form (Form Trigger) — No auth required. This node presents a custom-branded web form to collect the candidate's Full Name, Email, and CV (PDF upload). The form is styled with a dark, glassmorphism theme and includes animated backgrounds. Once submitted, the workflow triggers automatically. Log Candidate Submission (Google Sheets) — OAuth2. Immediately after form submission, this node appends the candidate's name and email to the 'CVs' Google Sheet. This ensures the application is recorded even if the subsequent analysis steps fail. Extract CV Text (Mistral AI) — API Key auth. This node takes the uploaded PDF file from the form and uses Mistral's OCR API to extract all text content from the CV. It dynamically selects the binary file uploaded in the previous step. AI Qualification (LLM Chain) — This is the core analysis node. It uses a detailed prompt that includes: - A system message defining the AI as a professional, objective hiring assistant. - The full job description for a "Senior Frontend Developer" with core requirements and preferred qualifications. - Clear evaluation logic: candidates missing core requirements cannot score above 0.6; meeting all core requirements yields at least 0.75; preferred qualifications add bonuses up to 1.0. - The extracted CV text as context. - An instruction to output raw JSON only. Gemini 2.5 Flash Lite (Language Model) — API Key auth (Google AI Studio). This node provides the actual AI model (Google Gemini 2.5 Flash Lite) with a temperature of 0.4 for balanced, deterministic outputs. It powers the LLM Chain above. JSON Output Parser (Output Parser) — This node ensures the AI's response is valid JSON with the exact schema: (number) and (string). It prevents malformed responses from breaking downstream nodes. Add CV Analysis (Google Sheets) — OAuth2. After analysis, this node updates the candidate's row in the 'CVs' sheet by matching on the Email column. It writes the and from the AI's output into the corresponding columns. Create 'CVs' Spreadsheet (Google Sheets) — OAuth2. This node runs once when the workflow is first triggered manually. It creates a new Google Sheet named 'CVs' with columns: FullName, Email, QualificationRate, QualificationDescription. Setup Instructions Prerequisites A Google account (for Google Sheets) A Mistral AI account (free tier available) — Get your API key here A Google AI Studio account — Create an API key here Step-by-Step Google Sheets Credentials: In the three Google Sheets nodes, create or select an OAuth2 credential for Google Sheets. Grant access to create and edit spreadsheets. Mistral AI Credential: In the "Extract CV Text" node, create a new credential and paste your Mistral API key. Gemini Credential: In the "Gemini 2.5 Flash Lite" node, create a new credential and paste your Google AI Studio API key. Customize Job Description: Open the "AI Qualification" node and edit the section in the prompt to match your actual job posting. Activate the Workflow: Toggle the workflow to "Active" status. The "Application Form" node will generate a public URL you can share with candidates. Test: Use the "Start Here" manual trigger to initialize the Google Sheet, then submit a test application via the form URL. Use Cases & Variations Custom Job Roles: Replace the Senior Frontend Developer description with any role (e.g., Marketing Manager, Data Scientist, Sales Rep) by editing the prompt in the AI Qualification node. Different Storage: Replace Google Sheets with Airtable, Notion, or a database like PostgreSQL for storing applications and results. Multi-Round Screening: Add a Slack or email notification node to alert the hiring team when a candidate scores above a certain threshold (e.g., >0.8). Interview Scheduling: Connect the output to a Calendly or Google Calendar node to automatically invite high-scoring candidates for an interview. Batch Processing: Modify the trigger to accept a CSV upload of multiple CVs for bulk analysis. Enhanced Analysis: Add more output fields like "years of experience", "top skills", or "red flags" by updating the JSON schema in the Output Parser and the prompt.

18 nodes

Telegram Blockchain DEX Screener AI Agent with Real-Time Token Insights

Overview This workflow creates an intelligent Telegram chatbot powered by OpenAI that provides real-time insights from the DexScreener API. It acts as a personal blockchain DEX research assistant, allowing users to query token profiles, boosted tokens, trading pairs, liquidity pools, and order status directly through Telegram messages. The AI agent automatically determines which DexScreener data sources to query based on the user's natural language request. How It Works The workflow combines two trigger methods (Telegram and n8n Chat) with an OpenAI-powered agent that has access to eight specialized DexScreener API tools. When a user sends a message via Telegram, the workflow extracts the chat ID for session management, passes the message text to the AI agent, which then intelligently selects and calls the appropriate DexScreener tools to gather data, and finally returns the formatted response back to the user in Telegram. Node Breakdown Telegram Trigger (No auth) — Listens for incoming Telegram messages. Configured to capture all message updates. Requires a Telegram bot token set up in n8n credentials. When chat message received (No auth) — An alternative n8n Chat trigger that also captures messages, providing a webhook-based interface for testing or alternative chat frontends. Adds SessionId (No auth) — A Set node that extracts the from the Telegram message and assigns it as a variable. This enables the AI agent to maintain conversation context per user. OpenAI Chat Model (API Key auth) — Uses the model to power the AI agent's natural language understanding and response generation. Requires an OpenAI API key configured in n8n credentials. Window Buffer Memory (No auth) — Provides short-term conversation memory to the AI agent, allowing it to remember context from previous messages within the same session. Blockchain DEX Screener Insights Agent (No auth) — The core AI agent node. It receives the user's message text from the Telegram trigger and uses a detailed system prompt that describes all available DexScreener tools. The agent autonomously decides which tools to call based on the user's query. DexScreener Latest Token Profiles (No auth) — HTTP Request tool that fetches the latest token profiles from . Rate limit: 60 requests/min. DexScreener Latest Boosted Tokens (No auth) — HTTP Request tool that retrieves the latest boosted tokens from . Rate limit: 60 requests/min. DexScreener Top Token Boosts (No auth) — HTTP Request tool that gets tokens with the most active boosts from . Rate limit: 60 requests/min. DexScreener Search Pairs (No auth) — HTTP Request tool that searches for trading pairs via . Accepts a query parameter. Rate limit: 300 requests/min. DexScreener Check Orders Paid for Token (No auth) — HTTP Request tool that checks orders for a specific token using . Rate limit: 60 requests/min. DexScreener Get Pairs by Chain and Pair Address (No auth) — HTTP Request tool that retrieves pairs by chain and pair address from . Rate limit: 300 requests/min. DexScreener Token Pools (No auth) — HTTP Request tool that fetches liquidity pools for a token from . Rate limit: 300 requests/min. DexScreener Pairs by Token Address (No auth) — HTTP Request tool that retrieves pairs by token address from . Supports comma-separated addresses. Rate limit: 300 requests/min. Telegram (No auth) — Sends the AI agent's response back to the user. Uses the chat ID from the original trigger message and outputs the agent's text response. Setup Instructions Telegram Bot: Create a bot via @BotFather on Telegram and obtain your bot token. Add this as a credential in n8n under "Telegram API". OpenAI Account: Sign up at platform.openai.com and generate an API key. Add this as a credential in n8n under "OpenAI". No additional accounts needed: The DexScreener API is public and requires no authentication. Activate the workflow: After configuring credentials, activate the workflow and send a message to your Telegram bot to test. Use Cases & Variations Trading Research: Ask the bot "What are the latest boosted tokens?" or "Show me top token boosts today" Pair Analysis: Query "Find SOL/USDC pairs" or "Get details for pair 0x... on Ethereum" Portfolio Monitoring: Ask "Check orders for token 0x... on chain 1" Liquidity Analysis: Request "Show me pools for token 0x... on BSC" Variation: Replace Telegram with Slack, Discord, or email triggers for different notification channels Variation: Add a database node to store historical queries and responses for analytics Variation: Add filtering logic to only alert on specific price movements or volume thresholds

15 nodes

Nextcloud Folder Move with Subfolder Support

Overview This workflow automates the process of moving a folder (including all its files and subfolders) from one location to another within a Nextcloud instance. It is especially useful when dealing with external storage that has rate limits, as it moves each file individually to avoid exceeding those limits. The workflow supports recursive traversal of subfolders, recreates the destination folder structure, and optionally deletes the source folder after the move. How It Works The workflow can be triggered manually, via a webhook, or from another workflow. It first validates the input (source and destination paths), then creates the destination folder if it doesn't exist. It lists all files and folders in the source, loops through them, and for each subfolder it recursively lists its contents. All discovered files are collected and then moved one by one to the correct location in the destination. Finally, the original source folder can be deleted (optional). Node Breakdown When clicking "Execute Workflow" (Manual Trigger) — No auth. Starts the workflow when the user clicks the execute button in the editor. Requires the user to set the source and destination paths in the Set paths node. Webhook (Webhook Trigger, disabled) — No auth. Listens for incoming POST requests at a unique path. Expects a JSON body with and properties. The workflow validates the request and proceeds. Execute Workflow Trigger (disabled) — No auth. Allows another n8n workflow to start this one, passing and as parameters. Whether the request is valid / Whether the request is valid1 (IF) — No auth. Checks that the incoming JSON has the required and fields. If not, it stops with an error. Stop and Error: request not valid / Stop and Error: request not valid1 (Stop & Error) — No auth. Throws an error message if validation fails. Set paths (Set) — No auth. Hardcoded example values for manual trigger: , . Users should edit these. Set folder-paths for from and to (Set) — No auth. Extracts and from the incoming data (manual, webhook, or workflow trigger) and passes them downstream. Create to folder if necessary (Nextcloud) — Nextcloud OAuth2 or Basic Auth. Creates the destination folder if it doesn't already exist. Uses the path from the field. Get all folders/files in from-folder (Nextcloud) — Nextcloud OAuth2 or Basic Auth. Lists all items (files and folders) in the source folder. Loop over files and folders (SplitInBatches) — No auth. Iterates over the list of items, processing them in batches (default batch size 1). Whether type is file (IF) — No auth. Checks if the current item is a file or a folder. Files go to consolidation; folders go to subfolder handling. Set new path for subfolder (Set) — No auth. Constructs the destination path for a subfolder by combining the base destination path with the subfolder name. Create subfolder in to-folder (Nextcloud) — Nextcloud OAuth2 or Basic Auth. Creates the corresponding subfolder in the destination. Get all folders/files in found subfolder (Nextcloud) — Nextcloud OAuth2 or Basic Auth. Lists the contents of the subfolder (recursive step). Consolidate all files and folders found (NoOp) — No auth. Acts as a junction point to collect all discovered files from recursive calls. Whether there is are more files or subfolders found (IF) — No auth. Checks if the loop has finished (no items left). If yes, proceeds to consolidate; otherwise loops back to process more items. Consolidate all found files (Code) — No auth. JavaScript code that gathers all file items from the NoOp node across multiple iterations into a single array. Set new path for file (Code) — No auth. JavaScript code that calculates the new destination path for each file by stripping the source prefix and appending the relative path to the destination. Loop Over all files (SplitInBatches) — No auth. Iterates over the consolidated list of files, moving them one by one. Move file to destination (Nextcloud) — Nextcloud OAuth2 or Basic Auth. Moves a file from its current path to the computed destination path. Delete from-folder (Nextcloud) — Nextcloud OAuth2 or Basic Auth. (Optional) Deletes the original source folder after all files have been moved. The node has error handling set to continue on error. Setup Instructions Nextcloud Credentials: You need a Nextcloud account with read/write access to both the source and destination folders. In n8n, create a Nextcloud credential (OAuth2 or Basic Auth) and apply it to all Nextcloud nodes in the workflow. Configure Triggers: - For manual execution, edit the Set paths node with your actual source and destination folder paths (e.g., , ). - For webhook, enable the Webhook node and copy the generated URL. Send a POST request with a JSON body like . - For workflow trigger, pass and as parameters when calling this workflow from another. Optional: If you want to delete the source folder after the move, leave the Delete from-folder node connected. If not, you can disable or remove it. Run: Activate the workflow and trigger it using your chosen method. Use Cases & Variations Migrating data between Nextcloud instances (if both are accessible via the same credentials). Archiving old projects by moving entire project folders to an archive directory. Organizing shared folders where users upload files into a drop folder and you want to move them to a structured destination. Handling rate-limited external storage (e.g., Google Drive mounted in Nextcloud) by moving files individually instead of a bulk move. Adaptation: Replace the Nextcloud nodes with other file storage services (e.g., ownCloud, S3, Google Drive) by swapping the node types and adjusting paths accordingly.

32 nodes

Ready to automate with n8n?

Get affordable managed n8n hosting with 24/7 support.