
Transactionsyncing
- 25 installs
- 316 repo stars
- Updated August 1, 2026
- aojdevstudio/finance-guru
TransactionSyncing is a Claude Code skill that imports Fidelity transaction history CSVs into Google Sheets and auto-routes debit card purchases to a categorized Expense Tracker.
About
TransactionSyncing is a Claude skill that imports Fidelity transaction history CSVs into Google Sheets. It maintains a master Transactions tab as a full audit trail, deduplicates rows by date, action, and amount, and auto-routes debit card purchases to an Expense Tracker with pattern-based categorization for Budget Planner integration. A developer or investor uses it to keep transaction and expense records in sync after downloading a Fidelity history export.
- Imports Fidelity transaction history CSVs into a Google Sheets master tab
- Auto-routes debit card purchases into an Expense Tracker with categorization
- Deduplicates by date, action, and amount and generates a sync summary
Transactionsyncing by the numbers
- 25 all-time installs (skills.sh)
- Ranked #695 of 1,106 Finance & Trading skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
transactionsyncing capabilities & compatibility
- Capabilities
- transaction sync · csv import · expense categorization · deduplication
- Works with
- google drive
- Use cases
- trading · data analysis
What transactionsyncing says it does
Import and manage Fidelity transaction history CSVs.
Routes DEBIT CARD PURCHASE entries to Expense Tracker
npx skills add https://github.com/aojdevstudio/finance-guru --skill transactionsyncingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 25 |
|---|---|
| repo stars | ★ 316 |
| Last updated | August 1, 2026 |
| Repository | aojdevstudio/finance-guru ↗ |
What it does
Importing Fidelity transaction history into Google Sheets and auto-categorizing debit card expenses.
Who is it for?
Investors importing Fidelity transaction history and tracking categorized expenses in Google Sheets
When should I use this skill?
User mentions sync transactions, import transactions, transaction history, or import Fidelity History CSV
By the numbers
- 2 workflows (IngestTransactions, SyncTransactions)
- 7 transaction types mapped
- 9-column Transactions tab layout
Files
TransactionSyncing
Import Fidelity transaction history CSV into Google Sheets using a hybrid architecture: master Transactions tab for full audit trail + auto-routing of debit card purchases to Expense Tracker for Budget Planner integration.
Workflow Routing
When executing this workflow, output this notification:
Running the **SyncTransactions** workflow from the **TransactionSyncing** skill...| Workflow | Trigger | File |
|---|---|---|
| IngestTransactions | "ingest transactions", "import history", "bring in transactions", user points to Downloads CSV | workflows/IngestTransactions.md |
| SyncTransactions | "sync transactions", "push to sheets", "transaction sync" | workflows/SyncTransactions.md |
Typical flow: IngestTransactions (local archive) -> SyncTransactions (Google Sheets)
Examples
Example 1: Sync after downloading Fidelity transaction history
User: "sync transactions"
-> Reads History_for_Account_{account_id}.csv from notebooks/transactions/
-> Creates/updates Transactions tab with full Fidelity data
-> Routes DEBIT CARD PURCHASE entries to Expense Tracker
-> Auto-categorizes expenses (H-E-B -> Groceries, Tesla -> Auto & Transport)
-> Reports: "Added 45 transactions, 12 expenses categorized"Example 2: Import new transaction export
User: "import the transaction history"
-> Invokes SyncTransactions workflow
-> Detects duplicates by date + action + amount
-> Skips existing entries, adds only new ones
-> Flags uncategorized expenses for manual reviewExample 3: Check recent transactions
User: "import fidelity transactions and update expense tracker"
-> Full sync with expense routing
-> Generates summary of dividends received, purchases, margin interestArchitecture Overview
Data Flow
Fidelity CSV (notebooks/transactions/)
|
v
+-------------------+
| Transactions Tab | <- Master source (ALL transactions)
| (Full Fidelity) |
+-------------------+
|
| Filter: DEBIT CARD PURCHASE
v
+-------------------+
| Expense Tracker | <- Budget Planner integration
| (Categorized) |
+-------------------+Transaction Types Handled
| Fidelity Action | Destination | Category |
|---|---|---|
| DIVIDEND RECEIVED | Transactions only | DIVIDEND |
| REINVESTMENT | Transactions only | REINVESTMENT |
| DEBIT CARD PURCHASE | Transactions + Expense Tracker | Auto-categorized |
| MARGIN INTEREST | Transactions only | MARGIN_INTEREST |
| DIRECT DEPOSIT | Transactions only | INCOME |
| LONG-TERM CAP GAIN | Transactions only | CAP_GAIN |
| JOURNALED | Transactions only | INTERNAL_TRANSFER |
Smart Categorization
See CategoryRules.md for the full pattern matching rules.
Sample patterns:
H-E-B,KROGER,COSTCO,WAL-MART-> GroceriesTesla,SUPERCHA-> Auto & TransportBENIHANA,GOLDEN CORRAL,PAPA JOHN-> Dining OutCVS,PHARMACY-> Health & Wellness
Core Workflow
1. Read Fidelity Transaction History CSV
Location: notebooks/transactions/History_for_Account_{account_id}.csv
CSV Columns:
Run Date, Action, Symbol, Description, Type, Price ($), Quantity,
Commission ($), Fees ($), Accrued Interest ($), Amount ($),
Cash Balance ($), Settlement Date2. Create/Update Transactions Tab
Google Sheets Structure:
| Column | Header | Source |
|---|---|---|
| A | Date | Run Date |
| B | Action | Action (cleaned) |
| C | Symbol | Symbol |
| D | Description | Description |
| E | Type | Type (Cash/Margin) |
| F | Amount | Amount ($) |
| G | Category | Auto-assigned |
| H | Balance | Cash Balance ($) |
| I | Settlement | Settlement Date |
3. Deduplicate
Match criteria: Date + Action + Amount
For each CSV row:
key = f"{run_date}|{action}|{amount}"
if key exists in sheet:
SKIP (already imported)
else:
ADD to Transactions tab4. Route Expenses to Expense Tracker
Filter: Action contains "DEBIT CARD PURCHASE"
Expense Tracker Format:
| Date | Description | Category | Amount | Month |
|---|
Category Assignment: See CategoryRules.md
5. Generate Summary
SYNC SUMMARY - [Date]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TRANSACTIONS TAB:
New entries: 45
Skipped (duplicates): 12
EXPENSE TRACKER:
Expenses routed: 18
Auto-categorized: 15
Needs review: 3
BY TYPE:
Dividends: $342.50
Margin Interest: -$18.43
Debit Card: -$1,245.67
Direct Deposit: +$5,054.09
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Google Sheets Integration
Spreadsheet ID: Read from fin-guru/data/user-profile.yaml -> google_sheets.portfolio_tracker.spreadsheet_id
Creating Transactions Tab (if needed)
// Check if Transactions tab exists
mcp__gdrive__sheets(operation: "listSheets", params: {
spreadsheetId: SPREADSHEET_ID
})
// Create if missing
mcp__gdrive__sheets(operation: "createSheet", params: {
spreadsheetId: SPREADSHEET_ID,
title: "Transactions"
})
// Add headers
mcp__gdrive__sheets(operation: "updateCells", params: {
spreadsheetId: SPREADSHEET_ID,
range: "Transactions!A1:I1",
values: [["Date", "Action", "Symbol", "Description", "Type", "Amount", "Category", "Balance", "Settlement"]]
})Adding to Expense Tracker
// Append expense row
mcp__gdrive__sheets(operation: "appendRows", params: {
spreadsheetId: SPREADSHEET_ID,
sheetName: "Expense Tracker",
values: [[date, description, category, amount, month]]
})Critical Rules
WRITABLE Destinations
- Transactions tab: All columns (new tab, we control format)
- Expense Tracker: Append new rows only (preserve existing)
NEVER MODIFY
- Budget Planner formulas
- Existing Expense Tracker entries
Deduplication Key
- Transactions tab:
Date|Action|Amount - Expense Tracker:
Date|Description|Amount
Reference Files
- CategoryRules.md: Pattern matching rules for expense categorization
- fin-guru/data/user-profile.yaml: Spreadsheet ID
- scripts/google-sheets/portfolio-optimizer/: Apps Script reference
Pre-Flight Checklist
Before syncing transactions:
- [ ] Transaction History CSV exists in
notebooks/transactions/ - [ ] CSV is from Fidelity (not other broker)
- [ ] Expense Tracker tab exists in Google Sheets
- [ ] Current date retrieved via
datecommand
---
Skill Type: Domain (workflow guidance) Enforcement: SUGGEST Priority: Medium Line Count: < 300 (following 500-line rule)
CategoryRules - Expense Categorization Patterns
Pattern matching rules for auto-categorizing debit card purchases from Fidelity transaction history.
How to Add New Patterns
To add a new categorization rule:
1. Identify the merchant name pattern from Fidelity descriptions 2. Add to the appropriate category section below 3. Patterns are case-insensitive 4. Use partial matches (e.g., "h-e-b" matches "H-E-B #063 Pearland TX")
---
Category Patterns
Groceries
Supermarkets, grocery stores, food supplies
Patterns:
h-e-b,hebkrogercostcowal-mart,walmartwholefds,whole foodsmakolatarget(when food context)sam's clubalditrader joe
Examples:
- "H-E-B #063 Pearland TX" -> Groceries
- "COSTCO WHSE #1 PEARLAND TX" -> Groceries
- "MAKOLA IMPORTS HOUSTON TX" -> Groceries
---
Dining Out
Restaurants, fast food, entertainment dining
Patterns:
benihanagolden corralpapa johnchuck e cheesewingstopcinemarkmcdonaldchick-fil-achipotlestarbuckscoffeerestaurantgrillcafemakiinsparkly photo(event dining)
Examples:
- "BENIHANA SUGAR LAND" -> Dining Out
- "TST*MAKIIN Houston TX" -> Dining Out
- "PAPA JOHN'S #2 PEARLAND TX" -> Dining Out
---
Auto & Transport
Vehicle expenses, fuel, parking, transportation
Patterns:
teslasupercha(Tesla Supercharger)parkingfastparkuberlyftshellexxonchevronvalerobuc-eegas stationtoll
Examples:
- "Tesla, Inc. SUPERCHA600118984238637" -> Auto & Transport
- "FASTPARKHOU HOUSTON TX" -> Auto & Transport
- "Tesla Property Casual Fremont CA" -> Auto & Transport
---
Personal Care
Grooming, beauty, self-care
Patterns:
salonspabarbersephorabeauty supplysupreme beautyultanailhairshaving gracegloss* skincash app*(often personal transfers)
Examples:
- "K STAR SALON & SPA MANVEL TX" -> Personal Care
- "A SHAVING GRACE BARBER PEARLAND TX" -> Personal Care
- "SEPHORA PEACHT PEACHTREE CI GA" -> Personal Care
---
Health & Wellness
Medical, pharmacy, fitness
Patterns:
cvspharmacywalgreenslife time(gym)doctormedicaldentalclinichospitalurgent care
Examples:
- "CVS/PHARMACY # MANVEL TX" -> Health & Wellness
- "LIFE TIME #320" -> Health & Wellness
---
Shopping
Retail, clothing, general merchandise
Patterns:
marshallstarget(non-food)amazonskimstj maxxrossold navygapnordstrommacybest buyapple store
Examples:
- "MARSHALLS #877 PEARLAND TX" -> Shopping
- "SP SKIMS CHECKOUT.SKIM CA" -> Shopping
---
Family Care
Childcare, family activities, kids
Patterns:
aqua totsbrightwheel,brghtwhldaycarechildcareschoolkidchildrenpediatric
Examples:
- "AQUA TOTS - PEARLAND" -> Family Care
- "BRGHTWHL R* REDEEMER" -> Family Care
---
Bills & Utilities
Recurring bills, subscriptions, utilities
Patterns:
autopayacctverifyelectricwaterinternetcomcastattverizont-mobilenetflixspotifysubscription
Examples:
- "BMO ACCTVERIFY" -> Bills & Utilities
---
Cash Withdrawal
ATM and cash transactions
Patterns:
atmcash withdrawalcash advance
Examples:
- "ATM0043 11555 MAGNOLIA PEARLAND TX" -> Cash Withdrawal
- "ATMXD10 *SEDONA LAKES MANVEL TX" -> Cash Withdrawal
---
Tuition
Education expenses
Patterns:
regent univeruniversitycollegetuitionschooleducationcourseraudemy
Examples:
- "REGENT UNIVERSPURCHASE" -> Tuition
---
Business Expense
Work-related purchases
Patterns:
gumroadupsfedexoffice depotstaplespostaluspsbusinesslinkedinzoom
Examples:
- "GUMROAD* SHAWN GRADY" -> Business Expense
- "POSTAL COPY CENTER-931 PEARLAND TX" -> Business Expense
---
Loan Payment
Debt payments
Patterns:
wells fargo+draftoraudraftloan paymentmortgagecar paymentstudent loancredit card payment
Examples:
- "WELLS FARGO AUDRAFT" -> Loan Payment
---
Home & Garden
Home improvement, garden, maintenance
Patterns:
home depotlowessawyersmart coregardenhardwarefurniture
Examples:
- "SAWYER + S* SMART CORE" -> Home & Garden
---
Crypto Deposit
Cryptocurrency deposits and transfers
Patterns:
btc depositedbitcoinfidelity cryptoeth depositedcrypto
Examples:
- "0.17713256 BTC deposited" -> Crypto Deposit
- "Fidelity Crypto® 8449251033" -> Crypto Deposit
---
Credit Card Payment
Credit card bill payments
Patterns:
applecardgsbapaymentchase paymentamex paymentdiscover payment
Examples:
- "DIRECT DEBIT APPLECARD GSBAPAYMENT" -> Credit Card Payment
---
Exempt
Verification transactions, zero amounts
Patterns:
ifacctverifyverification- Amount = $0.00 or < $1.00
Examples:
- "WELLS FARGO IFACCTVERIFY" -> Exempt
---
Uncategorized
Any transaction not matching the above patterns is marked as "Uncategorized" and flagged for manual review in the sync summary.
Common uncategorized reasons:
- New merchant not in patterns
- Unusual description format
- One-time or rare purchase
To resolve: Add the pattern to the appropriate category above.
---
Pattern Matching Algorithm
def categorize_expense(description: str) -> str:
desc = description.lower()
# Check each category's patterns
for category, patterns in CATEGORY_PATTERNS.items():
for pattern in patterns:
if pattern in desc:
return category
return "Uncategorized"
CATEGORY_PATTERNS = {
"Groceries": ["h-e-b", "heb", "kroger", "costco", "wal-mart", "walmart", ...],
"Dining Out": ["benihana", "golden corral", "papa john", ...],
"Auto & Transport": ["tesla", "supercha", "parking", "fastpark", ...],
# ... etc
}---
Extending Categories
When the user wants to add new categories or patterns:
1. Add to existing category: Update the patterns list above 2. Create new category: Add a new section with patterns and examples 3. Expense Tracker sync: Ensure the category name matches Budget Planner
Budget Planner categories (must match exactly):
- Groceries
- Dining Out
- Auto & Transport
- Personal Care
- Health & Wellness
- Shopping
- Family Care
- Bills & Utilities
- Cash Withdrawal
- Tuition
- Business Expense
- Loan Payment
- Home & Garden
- Crypto Deposit
- Credit Card Payment
- Exempt
- Software & Tech
- Cell Phone
- Gas
- Water
- Light Bill
- Mortgage
---
Last Updated: 2026-01-02 Maintainer: Finance Guru TransactionSyncing skill
IngestTransactions Workflow
Ingest Fidelity transaction history CSV from Downloads into the local rolling archive. Detects date range (30d/60d), creates date-stamped copy, merges unique rows into Accounts_History.csv.
Triggers
- "ingest transactions", "import history", "bring in transactions"
- User points to
~/Downloads/History_for_Account_Z05724592.csv - User mentions downloading transaction history from Fidelity
Step 1: Locate Source File
Default location: ~/Downloads/History_for_Account_Z05724592.csv Alternative: User may specify a different path.
# Verify file exists
ls -la ~/Downloads/History_for_Account_Z05724592.csvIf not found, ask user for the file location.
Step 2: Read and Analyze the CSV
CSV Schema (13 columns, header on row 3, rows 1-2 are blank):
Run Date, Action, Symbol, Description, Type, Price ($), Quantity,
Commission ($), Fees ($), Accrued Interest ($), Amount ($),
Cash Balance ($), Settlement DateDetect date range:
# Extract earliest and latest dates from the CSV (skip header rows, skip footer disclaimer)
awk -F',' 'NR>2 && $1 ~ /^[0-9]/ {print $1}' "$SOURCE_FILE" | sort -t/ -k3,3n -k1,1n -k2,2n | head -1 # earliest
awk -F',' 'NR>2 && $1 ~ /^[0-9]/ {print $1}' "$SOURCE_FILE" | sort -t/ -k3,3n -k1,1n -k2,2n | tail -1 # latestClassify period:
- Calculate days between earliest and latest date
- <= 35 days =
30d - <= 65 days =
60d - > 65 days =
{N}d(use actual count)
Count transaction rows (exclude blank lines and Fidelity disclaimer footer):
awk -F',' 'NR>2 && $1 ~ /^[0-9]/ {count++} END {print count}' "$SOURCE_FILE"Step 3: Copy with Date-Stamped Name
Destination: notebooks/transactions/
Naming convention: History_for_Account_Z05724592_{YYYY-MM-DD}_{period}.csv
Where:
{YYYY-MM-DD}= the download/run date (latest date in file, or today's date){period}=30d,60d, or{N}d
Example: History_for_Account_Z05724592_2026-03-06_60d.csv
cp ~/Downloads/History_for_Account_Z05724592.csv \
notebooks/transactions/History_for_Account_Z05724592_2026-03-06_60d.csvStep 4: Merge into Accounts_History.csv
Master archive: notebooks/transactions/Accounts_History.csv
Schema Normalization
The master archive may have a 14-column legacy schema (with Account, Account Number columns). New Fidelity downloads use a 13-column schema. Normalize as follows:
Canonical 13-column schema (used going forward):
Run Date, Action, Symbol, Description, Type, Price ($), Quantity,
Commission ($), Fees ($), Accrued Interest ($), Amount ($),
Cash Balance ($), Settlement DateIf the existing Accounts_History.csv has 14 columns (Account, Account Number after Run Date), strip those columns during merge. New rows always use 13-column format.
Deduplication
Match on: Run Date + Action + Amount($)
# Pseudocode for merge logic
existing_keys = set()
for row in accounts_history:
key = f"{row['Run Date']}|{row['Action'][:60]}|{row['Amount ($)']}"
existing_keys.add(key)
new_rows = []
for row in new_csv:
key = f"{row['Run Date']}|{row['Action'][:60]}|{row['Amount ($)']}"
if key not in existing_keys:
new_rows.append(row)Merge Strategy
1. Read all data rows from Accounts_History.csv (skip header, skip footer disclaimer) 2. Read all data rows from new CSV (skip blank rows 1-2, skip header row 3, skip footer) 3. Deduplicate using key above 4. Combine: existing rows + new unique rows 5. Sort by Run Date descending (newest first) 6. Write back with single header row + combined data (NO footer disclaimer)
Handle Missing Archive
If Accounts_History.csv doesn't exist:
- Copy the new CSV as the initial archive
- Strip blank rows and footer disclaimer
- Add proper header row
Step 5: Update notebooks/updates/ Copy
After merging, also update notebooks/updates/History_for_Account_Z05724592.csv with the latest download so other skills (dividend-tracking, etc.) can reference it:
cp ~/Downloads/History_for_Account_Z05724592.csv \
notebooks/updates/History_for_Account_Z05724592.csvStep 6: Extract Dividend Summary
From the newly ingested transactions, extract all DIVIDEND RECEIVED entries and report:
DIVIDEND INCOME (from this import)
Date | Symbol | Amount | Type
03/06/2026 | AMZY | $3.61 | Cash
03/06/2026 | AMZY | $14.82 | Margin
...
TOTAL: $XXX.XXThis data supplements (not replaces) the dividends.csv forward-looking projections.
Step 7: Generate Ingestion Report
TRANSACTION INGESTION COMPLETE - {date}
---
SOURCE: ~/Downloads/History_for_Account_Z05724592.csv
PERIOD: {earliest_date} to {latest_date} ({N}d)
ARCHIVED AS: History_for_Account_Z05724592_{date}_{period}.csv
MERGE RESULTS:
New rows added to Accounts_History: XX
Duplicates skipped: XX
Archive now covers: {earliest_archive_date} to {latest_archive_date}
Total archive rows: XX
TRANSACTION BREAKDOWN:
Dividends received: $XXX.XX (XX entries)
Reinvestments: $XXX.XX (XX entries)
Direct deposits: +$X,XXX.XX (XX entries)
Debit card: -$X,XXX.XX (XX entries)
Margin interest: -$XX.XX (XX entries)
Other: $XXX.XX (XX entries)
NEXT STEPS:
-> Run "sync transactions" to push to Google Sheets
-> Run "sync dividends" to update Dividend Tracker
---Gap Detection
After merge, check for date gaps > 3 business days in the archive. Report any gaps:
GAP ALERT: No transactions between {date1} and {date2} ({N} business days)
This may indicate a missing export period. Consider downloading that range.Error Handling
File not found
Source file not found at ~/Downloads/History_for_Account_Z05724592.csv
Please download your transaction history from Fidelity (last 30 or 60 days).Schema mismatch
WARNING: CSV schema doesn't match expected Fidelity format.
Expected 13 columns: Run Date, Action, Symbol, ...
Found: {N} columns
Please verify this is a Fidelity History export.Duplicate archive name
If History_for_Account_Z05724592_{date}_{period}.csv already exists:
- Compare file sizes. If identical, skip copy.
- If different, append a counter:
..._2026-03-06_60d_2.csv
---
Workflow Type: Local file management Estimated Duration: 10-20 seconds Dependencies: CSV file access, notebooks/transactions/ directory Chains to: SyncTransactions (optional, for Google Sheets push)
SyncTransactions Workflow
Import Fidelity transaction history CSV into Google Sheets with smart routing and categorization.
Step 1: Read Transaction History CSV
Location: notebooks/transactions/History_for_Account_{account_id}.csv
Read the CSV and parse:
# Expected columns (Row 3 has headers - skip rows 1-2)
Run Date, Action, Symbol, Description, Type, Price ($), Quantity,
Commission ($), Fees ($), Accrued Interest ($), Amount ($),
Cash Balance ($), Settlement DateKey Fields to Extract:
- Run Date: Transaction date (MM/DD/YYYY format)
- Action: Transaction type (DIVIDEND RECEIVED, DEBIT CARD PURCHASE, etc.)
- Symbol: Ticker symbol (if applicable)
- Description: Full description text
- Type: Cash or Margin
- Amount ($): Dollar amount (positive = credit, negative = debit)
- Cash Balance ($): Running balance after transaction
Step 2: Check/Create Transactions Tab
Read existing sheets:
mcp__gdrive__sheets(operation: "listSheets", params: {
spreadsheetId: "{spreadsheet_id}"
})If "Transactions" tab doesn't exist, create it:
mcp__gdrive__sheets(operation: "createSheet", params: {
spreadsheetId: "{spreadsheet_id}",
title: "Transactions"
})
// Add headers
mcp__gdrive__sheets(operation: "updateCells", params: {
spreadsheetId: "{spreadsheet_id}",
range: "Transactions!A1:I1",
values: [["Date", "Action", "Symbol", "Description", "Type", "Amount", "Category", "Balance", "Settlement"]]
})Step 3: Read Existing Transactions (for deduplication)
mcp__gdrive__sheets(operation: "readSheet", params: {
spreadsheetId: "{spreadsheet_id}",
range: "Transactions!A:F"
})Build deduplication set:
existing_keys = set()
for row in sheet_data:
key = f"{row['Date']}|{row['Action']}|{row['Amount']}"
existing_keys.add(key)Step 4: Process CSV Transactions
For each transaction in the CSV:
4a. Generate Deduplication Key
key = f"{run_date}|{action}|{amount}"
if key in existing_keys:
continue # Skip duplicate4b. Assign Category
Category Assignment Rules (see CategoryRules.md for full list):
def assign_category(action, description):
action_lower = action.lower()
desc_lower = description.lower()
# Investment categories (Transactions tab only)
if "dividend" in action_lower:
return "DIVIDEND"
if "reinvestment" in action_lower:
return "REINVESTMENT"
if "margin interest" in action_lower:
return "MARGIN_INTEREST"
if "cap gain" in action_lower:
return "CAP_GAIN"
if "direct deposit" in action_lower:
return "INCOME"
if "journaled" in action_lower:
return "INTERNAL_TRANSFER"
# Expense categories (route to Expense Tracker)
if "debit card" in action_lower:
return categorize_expense(desc_lower)
return "OTHER"
def categorize_expense(description):
# Groceries
if any(x in description for x in ['h-e-b', 'heb', 'kroger', 'costco',
'wal-mart', 'walmart', 'wholefds', 'whole foods', 'makola']):
return "Groceries"
# Dining Out
if any(x in description for x in ['benihana', 'golden corral', 'papa john',
'chuck e cheese', 'wingstop', 'cinemark']):
return "Dining Out"
# Auto & Transport
if any(x in description for x in ['tesla', 'supercha', 'parking',
'fastpark']):
return "Auto & Transport"
# Personal Care
if any(x in description for x in ['salon', 'spa', 'barber', 'sephora',
'beauty supply', 'cash app']):
return "Personal Care"
# Health & Wellness
if any(x in description for x in ['cvs', 'pharmacy', 'walgreens']):
return "Health & Wellness"
# Shopping
if any(x in description for x in ['marshalls', 'target', 'amazon',
'skims']):
return "Shopping"
# Family Care
if any(x in description for x in ['aqua tots', 'brightwheel']):
return "Family Care"
# Bills & Utilities
if any(x in description for x in ['autopay', 'acctverify']):
return "Bills & Utilities"
# Cash Withdrawal
if 'atm' in description:
return "Cash Withdrawal"
# Tuition
if 'regent univer' in description:
return "Tuition"
# Business Expense
if any(x in description for x in ['gumroad', 'ups']):
return "Business Expense"
# Loan Payment
if 'wells fargo' in description and 'draft' in description:
return "Loan Payment"
return "Uncategorized" # Flag for manual review4c. Build Transaction Row
transaction_row = [
run_date, # Date
clean_action(action), # Action (simplified)
symbol or "", # Symbol
description[:50], # Description (truncated)
tx_type, # Type (Cash/Margin)
amount, # Amount
category, # Category
balance, # Balance
settlement_date # Settlement
]Step 5: Batch Update Transactions Tab
// Append all new transactions at once
mcp__gdrive__sheets(operation: "appendRows", params: {
spreadsheetId: "{spreadsheet_id}",
sheetName: "Transactions",
values: new_transaction_rows
})Step 6: Route Expenses to Expense Tracker
Filter debit card purchases:
expense_rows = []
for tx in new_transactions:
if "debit card" in tx['action'].lower():
# Format for Expense Tracker
month = get_month_name(tx['date']) # "January", "February", etc.
expense_rows.append([
tx['date'],
tx['description'],
tx['category'],
format_amount(tx['amount']), # "$XX.XX" format
month
])Read existing Expense Tracker for deduplication:
mcp__gdrive__sheets(operation: "readSheet", params: {
spreadsheetId: "{spreadsheet_id}",
range: "Expense Tracker!A:D"
})Append only new expenses:
mcp__gdrive__sheets(operation: "appendRows", params: {
spreadsheetId: "{spreadsheet_id}",
sheetName: "Expense Tracker",
values: new_expense_rows
})Step 7: Generate Summary Report
TRANSACTION SYNC COMPLETE - [Date]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TRANSACTIONS TAB:
New entries added: XX
Duplicates skipped: XX
EXPENSE TRACKER:
Expenses routed: XX
Auto-categorized: XX
Needs review (Uncategorized): XX
TRANSACTION BREAKDOWN:
Dividends: $XXX.XX (XX entries)
Reinvestments: $XXX.XX (XX entries)
Margin Interest: -$XX.XX (XX entries)
Debit Card: -$X,XXX.XX (XX entries)
Direct Deposits: +$X,XXX.XX (XX entries)
Other: $XXX.XX (XX entries)
UNCATEGORIZED EXPENSES (needs review):
- [Date] [Description] [$Amount]
- [Date] [Description] [$Amount]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Helper Functions
clean_action(action)
Extract simplified action from verbose Fidelity text:
def clean_action(action):
if "DIVIDEND RECEIVED" in action:
return "DIVIDEND"
if "REINVESTMENT" in action:
return "REINVESTMENT"
if "DEBIT CARD PURCHASE" in action:
return "DEBIT CARD"
if "MARGIN INTEREST" in action:
return "MARGIN INTEREST"
if "DIRECT DEPOSIT" in action:
return "DIRECT DEPOSIT"
if "LONG-TERM CAP GAIN" in action:
return "CAP GAIN"
if "JOURNALED" in action:
return "JOURNAL"
return action[:30] # Truncateget_month_name(date_str)
from datetime import datetime
def get_month_name(date_str):
date = datetime.strptime(date_str, "%m/%d/%Y")
return date.strftime("%B") # "January", "February", etc.format_amount(amount)
def format_amount(amount):
return f"${abs(float(amount)):,.2f}"Error Handling
Missing CSV
ERROR: Transaction history CSV not found at notebooks/transactions/
Please download from Fidelity and place in the transactions folder.Empty CSV
WARNING: CSV contains no transactions to import.Google Sheets API Error
ERROR: Failed to update Google Sheets. Check:
1. Spreadsheet ID is correct
2. MCP gdrive server is connected
3. You have edit permissionsValidation Checklist
After sync, verify:
- [ ] Transactions tab contains new entries
- [ ] No duplicate transactions added
- [ ] Expense Tracker has new debit card purchases
- [ ] Categories are correctly assigned
- [ ] Uncategorized items are flagged in summary
- [ ] Amounts match CSV values
---
Workflow Type: Data sync Estimated Duration: 30-60 seconds Dependencies: mcp__gdrive__sheets, CSV file access
Related skills
FAQ
How does TransactionSyncing avoid duplicates?
It matches on Date + Action + Amount and skips rows already present in the sheet.
What gets routed to the Expense Tracker?
Entries whose action contains DEBIT CARD PURCHASE, auto-categorized by pattern rules.