Send portfolio risk reports with Google Sheets, GPT-4o-mini and Gmail
    100%
    Data Processing
    0(0 reviews)
    0 downloads

    Send portfolio risk reports with Google Sheets, GPT-4o-mini and Gmail

    NM

    Curated by n8n Markets team

    Last updated: June 24, 2026

    Quick Overview This workflow receives a portfolio via webhook (uploaded CSV or Google Sheets), calculates allocation and concentration risk metrics, generates an OpenAI HTML risk report, emails it through Gmail, and returns a JSON API response with the report status. How it works - Receives a POST webhook request containing a portfolio source type plus user name and email. - Loads holdings either by decoding an uploaded base64 CSV into rows or by reading rows from Google Sheets. - Combines all holdings into a single dataset and attaches user and source metadata. - Calculates portfolio totals, position weights, sector and asset-class breakdowns, concentration flags, top gainers/losers, and an overall risk score and label. - If the portfolio is valid, sends the computed metrics to OpenAI to generate a client-ready HTML risk narrative. - Builds a formatted HTML email that includes the AI analysis plus sector and top-holdings tables, then sends it to the user via Gmail and returns a success JSON response. - If the portfolio is empty or invalid, emails a failure notice via Gmail (when an email is provided) and returns a 422 JSON error response.

    What's Included

    • JSON Workflow

    How to Use

    - Create and connect credentials for Google Sheets OAuth2, OpenAI, and Gmail OAuth2. - Configure the webhook endpoint by copying the production URL and sending POST requests to the /portfolio-analyze path. - For CSV submissions, include base64 CSV content in body.fileData (or body.csvBase64/body.file) and ensure the columns include ticker, company, sector, quantity, avg_buy_price, current_price, and asset_class. - For Google Sheets submissions, update the spreadsheet document ID and sheet (gid) to the holdings table you want to analyze. - Ensure the request includes userEmail (body, query, or x-user-email header) so the workflow can deliver the report or validation error message.

    How to import this template into n8n

    1. Download the workflow JSON file from this page.
    2. In n8n, open Workflows, create a new workflow and choose Import from File.
    3. Open each node that shows a warning and connect your own credentials.
    4. Run the workflow once manually to check the output before you activate it.
    Included in Pro
    • Importable n8n workflow JSON file
    • Download with Builder Pro or Agency Unlimited
    • Built for n8n v1.0+
    • Setup time: 15 minutes

    Included in Builder Pro — $19/mo, 4,177 premium workflows

    Before you activate

    Templates are reviewed before they are listed. Test with your own credentials and data before running it in production.

    Updated Jun 2026
    v1.0.0
    SSL
    Secure
    GDPR

    100% Secure Checkout

    Refund requests within 7 days of a new subscription

    Dependencies & Requirements

    Gmail
    Communication
    Google Sheets
    Data
    OpenAI
    AI
    Webhook
    Trigger
    No credentials needed

    ⚠️ 3 services require credentials. Make sure you have accounts set up before importing.

    Reviews

    0

    No reviews yet

    See all 0 reviews ↓
    —

    0 reviews

    5★
    0
    4★
    0
    3★
    0
    2★
    0
    1★
    0

    No reviews yet.

    Questions & Answers

    0

    Log in to ask a question.

    No questions yet. Be the first to ask!

    People Also Bought