# Smart chat assistant with OpenAI and Google Sheets: n8n workflow

> Started by someone opening a chat with it, and works across Gmail, Google Drive, Google Sheets and Pinecone.

Source: https://millionrounds.com/workflow/smart-chat-assistant-with-openai-and-google-sheets (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Data collection](https://millionrounds.com/workflows?category=Data+collection#library)

# Smart chat assistant with OpenAI and Google Sheets

Started by someone opening a chat with it, and works across Gmail, Google Drive, Google Sheets and Pinecone. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 22 steps, 1 branch: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fsmart-chat-assistant-with-openai-and-google-sheets)

**22 steps** Large: read it before trusting it with anything live

**1** Branch: places the flow splits

**0** Loops or waits

**4** Services it connects to

## The flow

Starts it 3 Model 10 Logic 3 Service 6

The steps in the order they run, from what starts it.

- 1 **Short-Term Memory** Memory Buffer Window *Model*
- 2 **Output Parser (JSON Enforcement)** Output Parser Structured *Model*
- 3 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 4 **When chat message received** Chat trigger *Starts it*
- 5 **Google Drive Trigger** Google Drive trigger *Starts it*
- 6 **Recursive Character Text Splitter** Text Splitter Recursive Character Text Splitter *Model*
- 7 **Embeddings OpenAI** Embeddings Open Ai *Model*
- 8 **Schedule Trigger** Schedule trigger *Starts it*
- 9 **Get Previous Content from Sheet** Google Sheets Tool *Service*
- 10 **Embeddings OpenAI Query for Chat modal** Embeddings Open Ai *Model*
- 11 **AI Agent (Chat Composer)** Agent *Model*
- 12 **Format Data For AI Agent** Set *Logic*
- 13 **Download file** Google Drive *Service*
- 14 **Default Data Loader** Document Default Data Loader *Model*
- 15 **Pinecone Vector Store Insert** Vector Store Pinecone *Model*
- 16 **Get Data from Sheet.** Google Sheets *Service*
- 17 **Pinecone Vector Store Query for Knowledge Base** Vector Store Pinecone *Model*
- 18 **Conversation Logging** Google Sheets *Service*
- 19 **Aggregate** Aggregate *Logic*
- 20 **Convert Data to file** Convert To File *Service*
- 21 **Check File Exist** If *Logic*
- 22 **Send Chat History with attachment** Gmail *Service*

## How it's built

- **Starts on:** Someone opening a chat with it
- **Steps:** 22, with 1 branch
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Google Drive, Google Sheets, Pinecone
- **Model:** OpenAI
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Gmail, Google Drive, Google Sheets and Pinecone accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone opening a chat with it.

Does it use AI?

Yes. It calls OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 22 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 22 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fsmart-chat-assistant-with-openai-and-google-sheets)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Google Drive](https://millionrounds.com/workflows?service=Google+Drive#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[Pinecone](https://millionrounds.com/workflows?service=Pinecone#library)

## Workflows like it

Also data collection, with the same services where possible, closest in size first.

- [**Auto-index your website and build a RAG chatbot with Firecrawl** 22 steps · calls a model · Gmail, Qdrant](https://millionrounds.com/workflow/auto-index-your-website-and-build-a-rag-chatbot-with-firecra)
- [**Automate customer retention with Stripe** 22 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/automate-customer-retention-with-stripe)
- [**Classify client intake forms with Gemini and Gmail** 22 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/classify-client-intake-forms-with-gemini-and-gmail)
- [**Detect keyword cannibalization with OpenAI** 22 steps · calls a model · Google Sheets](https://millionrounds.com/workflow/detect-keyword-cannibalization-with-openai)
- [**Flexible currency rate uploads for SAP B1 with OpenAI** 22 steps · calls a model · Google Sheets](https://millionrounds.com/workflow/flexible-currency-rate-uploads-for-sap-b1-with-openai)
- [**Gate film and TV music cue rights clearance with Gmail** 22 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/gate-film-and-tv-music-cue-rights-clearance-with-gmail)
