# Lead automation with OpenAI and Gmail: n8n workflow template

> Started by a change in a Google Sheet, and works across Gmail, Google Calendar and Google Sheets.

Source: https://millionrounds.com/workflow/lead-automation-with-openai-and-gmail (Millionrounds; every figure on the page links to its filing or article)

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

# Lead automation with OpenAI and Gmail

Started by a change in a Google Sheet, and works across Gmail, Google Calendar and Google Sheets. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 24 steps, 2 branches: 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%2Flead-automation-with-openai-and-gmail)

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

**2** Branches: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Starts it 2 Model 7 Logic 6 Service 9

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

- 1 **Calendly Trigger** Calendly trigger *Starts it*
- 2 **Google Sheets Trigger** Google Sheets trigger *Starts it*
- 3 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 4 **Simple Memory** Memory Buffer Window *Model*
- 5 **Find available times** Google Calendar Tool *Service*
- 6 **Simple Memory1** Memory Buffer Window *Model*
- 7 **Book** Google Calendar Tool *Service*
- 8 **Edit Fields1** Set *Logic*
- 9 **Meeting Finder** Agent *Model*
- 10 **Reschedule Agent** Agent *Model*
- 11 **Append row in sheet1** Google Sheets *Service*
- 12 **Set message** Set *Logic*
- 13 **Code in JavaScript** Code *Logic*
- 14 **Send message and wait for response1** Gmail *Service*
- 15 **Message Lead** Gmail *Service*
- 16 **Set Lead Response** Set *Logic*
- 17 **Switch1** Switch *Logic*
- 18 **Structure Time** Open Ai *Model*
- 19 **Message a model** Open Ai *Model*
- 20 **Prep Loom** Gmail *Service*
- 21 **Switch** Switch *Logic*
- 22 **Update row in sheet1** Google Sheets *Service*
- 23 **Confirmation+Prep Loom** Gmail *Service*
- 24 **Update Status/new time** Google Sheets *Service*

## How it's built

- **Starts on:** A change in a Google Sheet
- **Steps:** 24, with 2 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Google Calendar, Google Sheets
- **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 Calendar and Google Sheets accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on a change in a Google Sheet.

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 24 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 24 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%2Flead-automation-with-openai-and-gmail)
- **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 Calendar](https://millionrounds.com/workflows?service=Google+Calendar#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)

## Workflows like it

Also lead generation, with the same services where possible, closest in size first.

- [**AI-powered Google Maps business scraper with OpenRouter** 24 steps · calls a model · Google Sheets](https://millionrounds.com/workflow/ai-powered-google-maps-business-scraper-with-openrouter)
- [**Automate lead enrichment & personalized outreach with HubSpot** 24 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/automate-lead-enrichment-and-personalized-outreach-with-hubs)
- [**Digitize business cards with Thai OCR** 24 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/digitize-business-cards-with-thai-ocr)
- [**Qualify mortgage leads and collect documents with Gemini** 24 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/qualify-mortgage-leads-and-collect-documents-with-gemini)
- [**Qualify real estate leads and answer EMI queries with Telegram** 24 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/qualify-real-estate-leads-and-answer-emi-queries-with-telegr)
- [**Score, route, and reply to inbound leads with OpenAI and Gmail** 24 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/score-route-and-reply-to-inbound-leads-with-openai-and-gmail)
