Skip to main content

Track commodity portfolio drift with Google Sheets, Gemini AI and Gmail alerts

Workflow preview

Workflow preview
100%
Track commodity portfolio drift with Google Sheets, Gemini AI and Gmail alerts preview
Open on n8n.io

1. Workflow Overview

Commodity Portfolio Tracker using n8n, Google Sheets, Gemini AI & Gmail Alerts This workflow automatically monitors a commodity portfolio stored in Google Sheets, compares actual allocation against...

Best for

  • Crypto Trading automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.googlesheets, n8n-nodes-base.set, n8n-nodes-base.merge, n8n-nodes-base.code, n8n-nodes-base.if, @n8n/n8n-nodes-langchain.googlegemini, n8n-nodes-base.gmail

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Track commodity portfolio drift with Google Sheets, Gemini AI and Gmail alerts
Workflow name
Track commodity portfolio drift with Google Sheets, Gemini AI and Gmail alerts

Commodity Portfolio Tracker using n8n, Google Sheets, Gemini AI & Gmail Alerts

This workflow automatically monitors a commodity portfolio stored in Google Sheets, compares actual allocation against predefined targets, detects deviations and sends intelligent rebalance alerts via email using Gemini AI. It also logs every run (success, failure or no action) into a tracking sheet for audit purposes.

Quick Implementation Steps

  1. Connect Google Sheets, Gmail and Gemini credentials in your n8n account
  2. Add holdings data in Google Sheets
  3. Configure targets in "Workflow Settings" node
  4. Create rebalance_log sheet with required columns
  5. Test workflow → Activate schedule

What It Does

This workflow acts as an automated portfolio monitoring system specifically designed for commodity-based investments such as Gold, Silver, Oil, Copper and Natural Gas. It reads portfolio holdings using the Read Holdings node and combines them with configuration from the Workflow Settings node.

The workflow validates data through Validate Portfolio Data, calculates allocation via Calculate Portfolio Allocation and identifies deviations using Detect Portfolio Drift. If deviations exceed limits, Classify Alert Severity determines how critical the situation is.

Finally, Build Alert Prompt and Generate Alert Message (Gemini AI) create a human-readable alert, which is processed in Prepare Alert Payload, sent via Send Rebalance Email and logged using Log Sent Alert, Log Validation Failure or Log No Action depending on the outcome.

Who It's For

  • Financial advisors managing client portfolios
  • Individual investors tracking commodity allocations
  • Portfolio managers looking for automation
  • FinTech developers building advisory tools
  • Anyone who wants rule-based rebalancing alerts

Requirements

  • n8n account (cloud or self-hosted)
  • Google Sheets account (for holdings + logs)
  • Gmail account (for sending alerts)
  • Google Gemini API credentials
  • Basic understanding of n8n nodes and workflows

How It Works & Setup Instructions

Step 1: Prepare Google Sheets

Create two sheets:

Holdings Sheet

Columns example: asset, units, price, current_value, last_updated

Log Sheet (rebalance_log)

Columns: run_date,total_value,rebalance_needed,severity,affected_assets,alert_sent,summary,reason_skipped

Step 2: Configure Workflow Settings Node

Update values inside Workflow Settings node:

  • Target allocation (must sum to 100)
  • Min/Max ranges
  • Alert email
  • Severity thresholds
  • Currency

Step 3: Connect Credentials

  • Google Sheets → used in Read Holdings, Log Sent Alert, Log Validation Failure, Log No Action
  • Gmail → used in Send Rebalance Email
  • Gemini → used in Generate Alert Message

Step 4: Workflow Execution Flow (Node-by-Node)

  1. Schedule Trigger starts the workflow
  2. Read Holdings fetches portfolio data
  3. Workflow Settings provides configuration
  4. Synchronize Inputs merges both sources
  5. Prepare Portfolio Context structures the data
  6. Validate Portfolio Data ensures correctness
  7. Check Validation Status routes valid/invalid data
  8. Calculate Portfolio Allocation computes percentages
  9. Detect Portfolio Drift identifies deviations
  10. Check Rebalance Requirement decides action path
  11. Classify Alert Severity assigns severity level
  12. Build Alert Prompt prepares AI input
  13. Generate Alert Message creates final message
  14. Merge Alert Data combines AI + data
  15. Prepare Alert Payload formats output
  16. Send Rebalance Email sends alert
  17. Log Sent Alert / Log No Action / Log Validation Failure store results

How To Customize Nodes

  • Workflow Settings: Change targets, thresholds, email
  • Schedule Trigger: Modify frequency (hourly/daily/weekly)
  • Gemini Node: Adjust tone of alert messages
  • Email Node: Add CC/BCC or change format
  • Code Nodes: Customize calculation logic (e.g., percentage vs amount-based rebalancing)

Add-ons

  • Slack integration for high severity alerts
  • Dashboard visualization using Google Data Studio
  • Multi-client portfolio support
  • Real-time price API integration (NSE, Alpha Vantage, etc.)
  • Risk scoring system for portfolios

Use Case Examples

  1. Daily monitoring of commodity portfolios
  2. Automated advisory alerts for wealth managers
  3. DIY investor portfolio tracking system
  4. Risk management for diversified assets
  5. Audit trail for compliance and reporting

There can be many more variations of this workflow depending on business needs.

Troubleshooting Guide

Issue Possible Cause Solution
No columns found Sheet missing headers Add header row in first row
Undefined values in log Wrong node connection Connect from payload node instead of email node
Email not sent Gmail credentials issue Reconnect Gmail account
AI output empty Prompt or API issue Check Gemini node input
Validation failed Incorrect data format Fix holdings sheet values

Need Help

If you need assistance setting up this workflow, customizing features or building automation solutions, feel free to reach out to our n8n experts at WeblineIndia.

We can help you:

  • Customize workflows for your business
  • Integrate advanced AI capabilities
  • Build scalable automation systems
  • Develop end-to-end FinTech solutions

Get in touch to turn your ideas into production-ready workflows.

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 - Overview Note

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

Block 2 - Input and Settings Note

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

Block 3 - Analysis and Decision Note

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

Block 4 - Alert Message and Logging Note

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

Block 5 - Read Holdings

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

Block 6 - Workflow Settings

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

Block 7 - Synchronize Inputs

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

Block 8 - Prepare Portfolio Context

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

Block 9 - Validate Portfolio Data

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

Block 10 - Check Validation Status

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 11 - Calculate Portfolio Allocation

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

Block 12 - Detect Portfolio Drift

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

Block 13 - Check Rebalance Requirement

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 14 - Classify Alert Severity

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

Block 15 - Build Alert Prompt

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

Block 16 - Generate Alert Message

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

Block 17 - Merge Alert Data

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

Block 18 - Prepare Alert Payload

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

Block 19 - Send Rebalance Email

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

Block 20 - Log Sent Alert

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

Block 21 - Prepare Validation Failure Log

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

Block 22 - Log Validation Failure

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

Block 23 - Prepare No Action Log

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

Block 24 - Log No Action

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

Showing the first 24 of 25 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Track commodity portfolio drift with Google Sheets, Gemini AI and Gmail alerts
Complexity advanced
Nodes 25
Categories Crypto Trading, AI Summarization
Author WeblineIndia
Published 27 Apr 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15333/15333.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 Track commodity portfolio drift with Google Sheets, Gemini AI and Gmail alerts do?

Commodity Portfolio Tracker using n8n, Google Sheets, Gemini AI & Gmail Alerts This workflow automatically monitors a commodity portfolio stored in Google Sheets, compares actual allocation against...

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 Crypto Trading, AI Summarization use case.