Skip to main content

Analyze client portfolio diversification using Google Sheets, OpenAI and Slack

Workflow preview

Workflow preview
100%
Analyze client portfolio diversification using Google Sheets, OpenAI and Slack preview
Open on n8n.io

1. Workflow Overview

Client Portfolio Diversification Check using n8n, Google Sheets, OpenAI & Slack This n8n workflow automatically analyzes client portfolio data from Google Sheets, evaluates sector allocation, risk ...

Best for

  • Market Research automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.googlesheets, n8n-nodes-base.slack, n8n-nodes-base.stickynote, n8n-nodes-base.if, n8n-nodes-base.googlesheetstrigger, n8n-nodes-base.set, n8n-nodes-base.code, @n8n/n8n-nodes-langchain.openai

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 client portfolio diversification using Google Sheets, OpenAI and Slack
Workflow name
Analyze client portfolio diversification using Google Sheets, OpenAI and Slack

Client Portfolio Diversification Check using n8n, Google Sheets, OpenAI & Slack

This n8n workflow automatically analyzes client portfolio data from Google Sheets, evaluates sector allocation, risk level and diversification quality and generates AI-powered insights. It also sends real-time alerts to Slack for invalid data and overexposed sectors while saving reports back to Google Sheets.

Quick Implementation Steps

  1. Create a Google Sheet with columns: Stock, Sector, Investment
  2. Add another sheet for reports with columns: timestamp, riskLevel, diversificationLevel, report
  3. Connect Google Sheets credentials in n8n
  4. Add your OpenAI API key
  5. Connect Slack OAuth and select a channel
  6. Activate the workflow

What It Does

This workflow continuously monitors client portfolio data by fetching records from Google Sheets every hour. It cleans and validates the data, ensuring that only meaningful entries (valid sector and investment values) are processed. Any invalid entries are immediately flagged and reported via Slack.

Once validated, the workflow performs financial analysis by grouping investments by sector, calculating allocation percentages and determining the portfolio's risk level. It also detects overexposure in sectors exceeding 40% allocation and calculates a diversification score to measure balance.

To enhance decision-making, the workflow leverages AI to generate concise portfolio insights and actionable recommendations. These insights, along with computed metrics, are formatted into a report, sent to Slack and stored in Google Sheets for future reference.

Who It's For

  • Financial advisors managing client portfolios
  • Investment analysts tracking diversification
  • Wealth management firms
  • FinTech teams building automated insights
  • Individual investors seeking portfolio health checks

Requirements

To use this workflow, ensure the following:

1. Google Sheets

  • Input Sheet must include columns:
  • Stock
  • Sector
  • Investment
  • Output Sheet must include:
  • timestamp
  • riskLevel
  • diversificationLevel
  • report

2. n8n Setup

3. Credentials Required

  • Google Sheets OAuth2 credentials
  • OpenAI API key (used with gpt-4o-mini)
  • Slack OAuth2 credentials

4. Slack Channel

  • A Slack channel must be selected for alerts and reports

How It Works & Setup Guide

Step 1: Trigger Workflow

  • The workflow starts using Google Sheets Trigger
  • Runs automatically every hour

Step 2: Fetch Portfolio Data

  • Reads data from the configured Google Sheet

Step 3: Normalize Data

  • Converts:
  • Stock → uppercase
  • Sector → uppercase
  • Investment → numeric value

Step 4: Validate Data

  • Conditions checked:
  • Investment > 0
  • Sector is not empty
  • Sector ≠ "UNKNOWN"
  • Invalid data → Slack alert sent
  • Valid data → continues processing

Step 5: Compute Sector Allocation

  • Groups investments by sector
  • Calculates total portfolio value
  • Computes allocation percentage per sector

Step 6: Risk & Exposure Analysis

  • Risk Levels:
  • Low (<30%)
  • Medium (30–50%)
  • High (>50%)
  • Detects overexposed sectors (>40%)

Step 7: Diversification Score

  • Measures how evenly investments are distributed
  • Labels:
  • Excellent (>80)
  • Good (>60)
  • Moderate (>40)
  • Poor (≤40)

Step 8: AI Insights Generation

  • Uses OpenAI (gpt-4o-mini)
  • Generates:
  • Portfolio summary
  • Risks
  • Diversification feedback
  • Actionable recommendations

Step 9: Overexposure Decision

  • If overexposed → Slack alert triggered

Step 10: Report Formatting

  • Combines:
  • Risk level
  • Diversification level
  • Allocation breakdown
  • AI insights

Step 11: Save & Notify

  • Saves report in Google Sheets
  • Sends formatted report to Slack

How To Customize Nodes

  • Risk Logic

  • Modify thresholds in Compute: Risk Score & Exposure

  • Diversification Calculation

  • Adjust scoring logic in Compute: Diversification Score

  • AI Prompt

  • Customize system prompt in AI: Portfolio Insights Generator

  • Change tone, length or recommendations style

  • Slack Messages

  • Edit message templates in Slack nodes for alerts and reports

  • Validation Rules

  • Add more conditions in Validate Data node (e.g., stock format)

Add-ons (Extend This Workflow)

  • Email alerts using SMTP node
  • Dashboard integration (e.g., Power BI / Looker Studio)
  • Historical trend analysis
  • Multi-client portfolio tracking
  • Automatic rebalancing suggestions
  • Integration with market data APIs

Use Case Examples

  1. Client Portfolio Monitoring
  • Automatically track diversification and risk exposure
  1. Wealth Advisory Automation
  • Provide AI-generated insights without manual analysis
  1. Compliance & Risk Alerts
  • Detect and alert overexposed portfolios instantly
  1. Investment Reporting
  • Generate structured reports for clients regularly
  1. Personal Finance Tracking
  • Individuals monitoring their own investment portfolios

These are just a few examples. This workflow can be adapted for many other financial automation scenarios.

Troubleshooting Guide

Issue Possible Cause Solution
No data fetched Incorrect Google Sheet ID Verify document ID and sheet selection
Invalid data alerts Missing or incorrect values Ensure all rows have valid Sector and Investment
AI not generating insights Missing OpenAI API key Add and verify OpenAI credentials
Slack messages not sent wrong Slack credentials or channel Reconnect Slack OAuth and verify channel
Report not saved wrong output sheet setup Ensure output sheet exists with correct columns
Workflow not running Trigger inactive Activate workflow in n8n

Need Help?

If you need assistance with:

  • Setting up this workflow
  • Customizing AI insights
  • Adding advanced features
  • Building similar automation workflows

Feel free to reach out to our n8n workflow developers at WeblineIndia for expert support.

We specialize in building scalable automation workflows tailored to your business needs.

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 - Fetch Portfolio Data

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

Block 2 - Slack Alert: Overexposure Warning

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

Block 3 - Sticky Note1

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

Block 4 - Sticky Note2

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

Block 5 - Sticky Note3

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

Block 6 - Validate Data (Sector + Investment)

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

Block 7 - Portfolio Update (Hourly)

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

Block 8 - Normalize Portfolio Data

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

Block 9 - Alert: Invalid Data

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

Block 10 - Compute: Sector Allocation Breakdown

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

Block 11 - Compute: Risk Score & Exposure

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

Block 12 - Compute: Diversification Score

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

Block 13 - AI: Portfolio Insights Generator

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 2.1

Block 14 - Transform: Extract AI Response

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

Block 15 - Decision: Overexposure Check

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

Block 16 - Format: Final Portfolio Report

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

Block 17 - Store: Save Report to Google Sheets

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

Block 18 - Report: Portfolio Summary

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

Block 19 - Sticky Note

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

Block 20 - Sticky Note4

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

3. Summary Table

Workflow Analyze client portfolio diversification using Google Sheets, OpenAI and Slack
Complexity advanced
Nodes 20
Categories Market Research, AI Summarization
Author WeblineIndia
Published 12 May 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15665/15665.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 client portfolio diversification using Google Sheets, OpenAI and Slack do?

Client Portfolio Diversification Check using n8n, Google Sheets, OpenAI & Slack This n8n workflow automatically analyzes client portfolio data from Google Sheets, evaluates sector allocation, risk ...

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 Market Research, AI Summarization use case.