Automation library · Alerts and monitoring

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.

LargeCalls a model: Gemini

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

The flow

Starts it 1Model 1Logic 14Service 5

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

  1. 1Daily Portfolio Rebalance CheckSchedule triggerStarts it
  2. 2Read HoldingsGoogle SheetsService
  3. 3Workflow SettingsSetLogic
  4. 4Synchronize InputsMergeLogic
  5. 5Prepare Portfolio ContextCodeLogic
  6. 6Validate Portfolio DataCodeLogic
  7. 7Check Validation StatusIfLogic
  8. 8Calculate Portfolio AllocationCodeLogic
  9. 9Prepare Validation Failure LogSetLogic
  10. 10Detect Portfolio DriftCodeLogic
  11. 11Log Validation FailureGoogle SheetsService
  12. 12Check Rebalance RequirementIfLogic
  13. 13Classify Alert SeverityCodeLogic
  14. 14Prepare No Action LogSetLogic
  15. 15Build Alert PromptCodeLogic
  16. 16Log No ActionGoogle SheetsService
  17. 17Generate Alert MessageGoogle GeminiModel
  18. 18Merge Alert DataMergeLogic
  19. 19Prepare Alert PayloadSetLogic
  20. 20Log Sent AlertGoogle SheetsService
  21. 21Send Rebalance EmailGmailService

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.