# Automated business KPI insights with OpenAI and MSSQL: n8n workflow

> Started by a clock, and works across Email, Google Sheets and WhatsApp. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/automated-business-kpi-insights-with-openai-and-mssql (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Alerts and monitoring](https://millionrounds.com/workflows?category=Alerts+and+monitoring#library)

# Automated business KPI insights with OpenAI and MSSQL

Started by a clock, and works across Email, Google Sheets and WhatsApp. It hands the judgement calls to OpenAI. 24 steps, 4 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomated-business-kpi-insights-with-openai-and-mssql)

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

**4** Branches: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Starts it 1 Model 3 Logic 10 Service 10

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

- 1 **Schedule Trigger** Schedule trigger *Starts it*
- 2 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 3 **Calculator** Tool Calculator *Model*
- 4 **Yesterday's Revenue** Microsoft Sql *Service*
- 5 **Yesterday's Registered Users** Microsoft Sql *Service*
- 6 **Yesterday's Report** Google Analytics *Service*
- 7 **Yesterday's Marketing Expenses** Google Sheets *Service*
- 8 **AI Agent** Agent *Model*
- 9 **Check data** If *Logic*
- 10 **If** If *Logic*
- 11 **Condition for google report** If *Logic*
- 12 **Condition for marketing reports** If *Logic*
- 13 **Merge** Merge *Logic*
- 14 **Get only Total Revenue Amount** Summarize *Service*
- 15 **Send Error Email** Email Send *Service*
- 16 **Get only Total Users** Summarize *Service*
- 17 **Get Only Total Users** Set *Logic*
- 18 **Get only Total Spend Amount** Summarize *Service*
- 19 **Send message** Whats App *Service*
- 20 **Send Final Email** Email Send *Service*
- 21 **Merge all result** Merge *Logic*
- 22 **Normalize the data** Code *Logic*
- 23 **KPI Calculator** Code *Logic*
- 24 **Business Decision Logic** Code *Logic*

## How it's built

- **Starts on:** A clock
- **Steps:** 24, with 4 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Email, Google Sheets, WhatsApp
- **Model:** OpenAI

## Questions

What does it need to run?

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

What starts it?

It starts on a clock.

Does it use AI?

Yes. It calls OpenAI. 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%2Fautomated-business-kpi-insights-with-openai-and-mssql)
- **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.

[Email](https://millionrounds.com/workflows?service=Email#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[WhatsApp](https://millionrounds.com/workflows?service=WhatsApp#library)

## Workflows like it

Also alerts and monitoring, with the same services where possible, closest in size first.

- [**Ad monitoring tool with Gemini** 24 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/ad-monitoring-tool-with-gemini)
- [**Assess AWS security posture changes with Claude and Slack** 24 steps · calls a model · Email, Slack](https://millionrounds.com/workflow/assess-aws-security-posture-changes-with-claude-and-slack)
- [**Monitor Japan Flight Prices & Generate Booking Alerts** 24 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/monitor-japan-flight-prices-and-generate-booking-alerts)
- [**Monitor brand mentions and draft crisis responses with OpenAI** 24 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/monitor-brand-mentions-and-draft-crisis-responses-with-opena)
- [**Monitor competitor prices and send OpenAI analysis alerts** 24 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/monitor-competitor-prices-and-send-openai-analysis-alerts)
- [**Monitor supplier risk daily with Groq and Google Sheets** 24 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/monitor-supplier-risk-daily-with-groq-and-google-sheets)
