Automation library · Data collection

Analyze commodity portfolio diversification with Sheets

Started by an event in a connected app, and works across Gmail and Google Sheets. It hands the judgement calls to Gemini. 24 steps, 1 branch: large, and worth reading before you trust it with anything live.

LargeCalls a model: Gemini

24 stepsLarge: read it before trusting it with anything live
1Branch: places the flow splits
0Loops or waits
2Services it connects to

The flow

Starts it 1Model 1Logic 16Service 6

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

  1. 1Start WorkflowManual triggerStarts it
  2. 2Initialize Configuration & API KeysSetLogic
  3. 3Load Portfolio Data from SheetsGoogle SheetsService
  4. 4Get Gold Price (INR)Http RequestService
  5. 5Get Silver Price (INR)Http RequestService
  6. 6Get Crude Oil Price (USD)Http RequestService
  7. 7Get Gold Trend Time SeriesHttp RequestService
  8. 8Merge Portfolio + Market DataMergeLogic
  9. 9Extract Gold Price ValueSetLogic
  10. 10Extract Silver Price ValueSetLogic
  11. 11Convert Oil Price USD to INRSetLogic
  12. 12Extract Trend Values (Latest vs Previous)SetLogic
  13. 13calculate Portfolio Allocation & HHI Risk ScoreCodeLogic
  14. 14Merge Commodity & Trend DataMergeLogic
  15. 15Generate AI Portfolio Analysis (Gemini)Google GeminiModel
  16. 16Aggregate Prices & Trend DataCodeLogic
  17. 17Parse AI Response into Structured FieldsCodeLogic
  18. 18Tag Commodities (Category + Symbol)SetLogic
  19. 19Generate HTML Report TemplateSetLogic
  20. 20Evaluate Market Trend DirectionIfLogic
  21. 21Send Portfolio Report via EmailGmailService
  22. 22Set Trend UPSetLogic
  23. 23Set Trend DOWNSetLogic
  24. 24Finalize Trend OutputMergeLogic

How it's built

Starts on
An event in a connected app
Steps
24, with 1 branch
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 an event in a connected app.

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 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.