Skip to main content

Analyze commodity portfolio diversification with Sheets, Gemini, and Gmail

Workflow preview

Workflow preview
100%
Analyze commodity portfolio diversification with Sheets, Gemini, and Gmail preview
Open on n8n.io

1. Workflow Overview

Quick Overview This workflow reads a gold/silver/oil portfolio from Google Sheets, pulls current commodity prices and a recent gold trend from GoldAPI, EIA, and Twelve Data, calculates allocation a...

Best for

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

Tools used

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

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
Analyze commodity portfolio diversification with Sheets, Gemini, and Gmail
Workflow name
Analyze commodity portfolio diversification with Sheets, Gemini, and Gmail

Quick Overview

This workflow reads a gold/silver/oil portfolio from Google Sheets, pulls current commodity prices and a recent gold trend from GoldAPI, EIA, and Twelve Data, calculates allocation and HHI concentration risk, generates a Gemini analysis, and emails an HTML diversification report via Gmail.

How it works

  1. Starts manually and loads configuration values, then reads your portfolio holdings from Google Sheets.
  2. Fetches real-time gold and silver prices in INR from GoldAPI, retrieves crude oil prices in USD from the EIA API, and converts oil prices to INR.
  3. Pulls the last two daily closes for GLD from Twelve Data and compares them to label the gold market trend as UP or DOWN.
  4. Aggregates the latest commodity prices and trend data, then calculates portfolio allocation percentages and an HHI concentration score from the Google Sheets holdings.
  5. Sends the allocation, HHI score, and gold trend to Google Gemini to generate a structured risk assessment, rebalancing recommendations, trend impact, and a verdict.
  6. Parses Gemini’s response into dedicated fields, builds a formatted HTML report with prices, allocations, risks, recommendations, and verdict, and sends it to the configured recipient via Gmail.

Setup

  1. Add API keys for GoldAPI, the U.S. EIA API, and Twelve Data in the configuration step (and confirm the USD-to-INR conversion rate is correct for your needs).
  2. Connect your Google Sheets account, then update the spreadsheet and sheet tab to a portfolio table that includes commodity_name and buy_price for gold, silver, and oil.
  3. Connect your Google Gemini (PaLM) API credential and ensure the selected model is available in your account.
  4. Connect your Gmail OAuth2 credential and set the recipient email address used for the report delivery.

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 - Set Trend UP

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

Block 2 - Set Trend DOWN

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

Block 3 - Extract Gold Price Value

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

Block 4 - Extract Silver Price Value

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

Block 5 - Merge Commodity & Trend Data

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

Block 6 - Evaluate Market Trend Direction

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

Block 7 - Generate AI Portfolio Analysis (Gemini)

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

Block 8 - Parse AI Response into Structured Fields

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

Block 9 - Generate HTML Report Template

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

Block 10 - Send Portfolio Report via Email

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

Block 11 - Sticky Note2

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

Block 12 - Sticky Note3

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

Block 13 - Sticky Note4

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

Block 14 - Sticky Note5

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

Block 15 - Sticky Note6

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

Block 16 - calculate Portfolio Allocation & HHI Risk Score

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

Block 17 - Sticky Note8

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

Block 18 - Sticky Note9

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

Block 19 - Sticky Note10

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

Block 20 - Start Workflow

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

Block 21 - Initialize Configuration & API Keys

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

Block 22 - Load Portfolio Data from Sheets

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

Block 23 - Get Gold Price (INR)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

Block 24 - Get Silver Price (INR)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

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

3. Summary Table

Workflow Analyze commodity portfolio diversification with Sheets, Gemini, and Gmail
Complexity advanced
Nodes 36
Categories Crypto Trading, AI Summarization
Author WeblineIndia
Published 15 Jun 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/16367/16367.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 Analyze commodity portfolio diversification with Sheets, Gemini, and Gmail do?

Quick Overview This workflow reads a gold/silver/oil portfolio from Google Sheets, pulls current commodity prices and a recent gold trend from GoldAPI, EIA, and Twelve Data, calculates allocation a...

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.