Skip to main content

Chat with a Google Sheet using AI

Workflow preview

Workflow preview
100%
Chat with a Google Sheet using AI preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This workflow allows you to ask questions about the data in a Google Sheet over a chat interface. It uses n8n's built in chat, but could be modified to work with Slack, Teams, WhatsApp, etc. Behind...

Best for

  • Internal Wiki automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.chattrigger, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.memorybufferwindow, n8n-nodes-base.executeworkflowtrigger, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.toolworkflow, n8n-nodes-base.set

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by David Roberts.

Original n8n.io source

1.1 Workflow description

Title
Chat with a Google Sheet using AI
Workflow name
Chat with a Google Sheet using AI

This workflow allows you to ask questions about the data in a Google Sheet over a chat interface. It uses n8n's built-in chat, but could be modified to work with Slack, Teams, WhatsApp, etc.

Behind the scenes, the workflow uses GPT4, so you'll need to have an OpenAI API key that supports it.

How it works

The workflow uses an AI agent with custom tools that call a sub-workflow. That sub-workflow reads the Google Sheet and returns information from it.

Because models have a context window (and therefore a maximum number of characters they can accept), we can't pass the whole Google Sheet to GPT - at least not for big sheets. So we provide three ways of querying less data, that can be used in combination to answer questions. Those three functions are:

  1. List all the columns in the sheet
  2. Get all values of a single column
  3. Get all values of a single row

Note that to use this template, you need to be on n8n version 1.19.4 or later.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 7 - OpenAI Chat Model1

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 8 - Simple Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 9 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 10 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.8

Block 11 - List columns tool

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2

Block 12 - Get column values tool

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2

Block 13 - Get customer tool

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2

Block 14 - Set Google Sheet URL

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 15 - Get Google sheet contents

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 16 - Check operation

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 17 - Get column names

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 18 - Prepare column data

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 19 - Filter

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 20 - Prepare output

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

3. Summary Table

Workflow Chat with a Google Sheet using AI
Complexity advanced
Nodes 20
Categories Internal Wiki, AI Chatbot
Author David Roberts
Published 07 Feb 2024

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2085/2085.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Chat with a Google Sheet using AI do?

This workflow allows you to ask questions about the data in a Google Sheet over a chat interface. It uses n8n's built in chat, but could be modified to work with Slack, Teams, WhatsApp, etc. Behind...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Internal Wiki, AI Chatbot use case.