# Track commodity portfolio drift with Google Sheets and Gemini: n8n workflow

> Started by a clock, and works across Gmail and Google Sheets. It hands the judgement calls to Gemini.

Source: https://millionrounds.com/workflow/track-commodity-portfolio-drift-with-google-sheets-and-gemin (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)

# Track commodity portfolio drift with Google Sheets and Gemini

Started by a clock, and works across Gmail and Google Sheets. It hands the judgement calls to Gemini. 21 steps, 2 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: Gemini

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-commodity-portfolio-drift-with-google-sheets-and-gemin)

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

**2** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 1 Model 1 Logic 14 Service 5

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

- 1 **Daily Portfolio Rebalance Check** Schedule trigger *Starts it*
- 2 **Read Holdings** Google Sheets *Service*
- 3 **Workflow Settings** Set *Logic*
- 4 **Synchronize Inputs** Merge *Logic*
- 5 **Prepare Portfolio Context** Code *Logic*
- 6 **Validate Portfolio Data** Code *Logic*
- 7 **Check Validation Status** If *Logic*
- 8 **Calculate Portfolio Allocation** Code *Logic*
- 9 **Prepare Validation Failure Log** Set *Logic*
- 10 **Detect Portfolio Drift** Code *Logic*
- 11 **Log Validation Failure** Google Sheets *Service*
- 12 **Check Rebalance Requirement** If *Logic*
- 13 **Classify Alert Severity** Code *Logic*
- 14 **Prepare No Action Log** Set *Logic*
- 15 **Build Alert Prompt** Code *Logic*
- 16 **Log No Action** Google Sheets *Service*
- 17 **Generate Alert Message** Google Gemini *Model*
- 18 **Merge Alert Data** Merge *Logic*
- 19 **Prepare Alert Payload** Set *Logic*
- 20 **Log Sent Alert** Google Sheets *Service*
- 21 **Send Rebalance Email** Gmail *Service*

## How it's built

- **Starts on:** A clock
- **Steps:** 21, with 2 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Google Sheets
- **Model:** Gemini

## Questions

What does it need to run?

An n8n account, plus your own Gmail and Google Sheets accounts, and a key for Gemini. 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 Gemini. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 21 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 21 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%2Ftrack-commodity-portfolio-drift-with-google-sheets-and-gemin)
- **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 Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)

## Workflows like it

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

- [**Automated Gmail classification and labeling with OpenAI** 21 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/automated-gmail-classification-and-labeling-with-openai)
- [**Automated n8n error monitoring alerts - Telegram, Slack & email** 21 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/automated-n8n-error-monitoring-alerts-telegram-slack-and-ema)
- [**Monitor and score new real estate listings with BrowserAct** 21 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/monitor-and-score-new-real-estate-listings-with-browseract)
- [**Monitor viral competitor Instagram posts with Apify and Groq** 21 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/monitor-viral-competitor-instagram-posts-with-apify-and-groq)
- [**Outlook inbox tamer: GPT-4.1 powered categorization, auto** 21 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/outlook-inbox-tamer-gpt-4-1-powered-categorization-auto)
- [**WordPress blog automation: AI SEO content, images, scheduling** 21 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/wordpress-blog-automation-ai-seo-content-images-scheduling)
