Sync dividend data from Fidelity CSV to Dividends sheet. Reads dividend.csv from notebooks/updates/, calculates actual dividends received (shares × amount per share), writes to input area (rows 2-46), then clicks Add Dividend button to process. Triggers on sync dividends, update dividends, dividend tracker, layer 2 income, or monthly dividend analysis.
Import Fidelity dividend CSV data into the Dividends sheet input area, then trigger the Apps Script to process records into the historical log.
When executing this workflow, output this notification:
Running the **SyncDividends** workflow from the **dividend-tracking** skill...
| Workflow | Trigger | Action |
|---|---|---|
| SyncDividends | "sync dividends", "update dividends", "dividend tracker" | CSV → Input Area → Click Button |
The Dividends tab has TWO SECTIONS:
This is where YOU write dividend records.
| Column | Field | Source |
|---|---|---|
| A | Ticket | CSV Symbol |
| B | Dividends Received | Calculated: Quantity × Amount per share |
| C | Date | CSV Pay date (MM/DD/YYYY format) |
| D | DRIP | TRUE/FALSE |
RULES:
This is populated by the Apps Script - DO NOT WRITE HERE.
| Column | Field |
|---|---|
| G | Fund Name |
| H | Ticker |
| I-T | Monthly amounts (JAN-DEC) |
| U | Total |
The Apps Script reads from the input area (A-D) and appends to the historical log (G onwards).
File Location: notebooks/updates/dividend.csv
Key CSV Columns:
| CSV Column | Use |
|---|---|
| Symbol | → Column A (Ticket) |
| Quantity | Used to calculate dividend received |
| Amount per share | Used to calculate dividend received |
| Pay date | → Column C (Date) - format as MM/DD/YYYY |
| Type | Margin/Cash (for aggregation) |
Dividends Received = Quantity × Amount per share
Aggregation Rules:
-- in Amount per share (non-dividend payers)Read current input area:
mcp__gdrive__sheets(
operation: "readSheet",
params: {
spreadsheetId: "{spreadsheet_id}",
range: "Dividends!A2:D43"
}
)
Determine:
Write starting at first empty row:
mcp__gdrive__sheets(
operation: "updateCells",
params: {
spreadsheetId: "{spreadsheet_id}",
range: "Dividends!A2:D13", // Adjust range based on record count
values: [
["JEPI", "$51.63", "01/05/2026", "TRUE"],
["JEPQ", "$78.62", "01/05/2026", "TRUE"],
// ... more records
]
}
)
After writing records, use browser automation to process them:
// 1. Open Google Sheets
mcp__claude-in-chrome__tabs_create_mcp({
url: "https://docs.google.com/spreadsheets/d/{spreadsheet_id}/edit#gid=2068577140"
})
// 2. Wait for sheet to load
// 3. Look for "Add Dividend" button or custom menu
// 4. Click to trigger Apps Script
Alternative: Use Apps Script Menu
After clicking button:
┌─────────────────────────────────┐
│ dividend.csv (Fidelity export) │
│ - Symbol, Quantity │
│ - Amount per share, Pay date │
└──────────────┬──────────────────┘
│
▼
┌─────────────────────────────────┐
│ Calculate Dividends Received │
│ Qty × Amount = Total Dividend │
│ Aggregate by ticker │
│ Filter: only PAST pay dates │
└──────────────┬──────────────────┘
│
▼
┌─────────────────────────────────┐
│ INPUT AREA (A2:D43) │
│ Write calculated dividends │
│ Max 42 records per batch │
└──────────────┬──────────────────┘
│
▼
┌─────────────────────────────────┐
│ CLICK "Add Dividend" BUTTON │
│ (Browser automation or manual) │
└──────────────┬──────────────────┘
│
▼
┌─────────────────────────────────┐
│ HISTORICAL LOG (G4+) │
│ Apps Script processes input │
│ Appends to monthly columns │
└─────────────────────────────────┘
The Dividends sheet has Apps Script automation that:
Script Location: scripts/google-sheets/portfolio-optimizer/Dividend.js
Custom Menu: "Portfolio Optimizer" → (dividend-related options)
Before syncing dividends:
dividend.csv exists in notebooks/updates/User: "sync dividends"
Agent workflow:
Spreadsheet ID: {spreadsheet_id}
Dividends Sheet ID: 2068577140
Direct URL: https://docs.google.com/spreadsheets/d/{spreadsheet_id}/edit#gid=2068577140
notebooks/updates/dividend.csvscripts/google-sheets/portfolio-optimizer/Dividend.jsSkill Type: Domain (workflow guidance) Enforcement: SUGGEST (high priority advisory) Priority: High