Skip to main content

Normalize CSV Command

Transform a single raw bank CSV export into standardized normalized format.

Arguments

  • $1: Path to a raw CSV file (e.g., data/raw_checkings.csv)

Input Format (Raw Bank Export)

Bank CSVs have varying formats:

Date,Description,Withdrawals,Deposits,Category,Balance
"01/31/2026","DEBIT CARD PURCHASE Amazon Prime*KV2819","$148.32","","Subscriptions","$42,156.78"

Output Format (Normalized)

date,description,category,deposit,withdrawal,balance,account_name
2026-01-31,Amazon Prime Subscription,,148.32,,42156.78,checkings

Normalization Rules

Date Conversion

  • Convert MM/DD/YYYY to YYYY-MM-DD (ISO 8601)
  • Filter out transactions from previous months

Amount Parsing

  • Remove $ symbols and commas
  • Withdrawals go in withdrawal column
  • Deposits go in deposit column
  • Leave blank (not 0) if no value

Description Cleaning

  • Remove card numbers (XXXXX1234)
  • Remove excess whitespace
  • Clean up merchant names

Account Name

  • Extract from filename: raw_checkings.csv -> checkings

Workflow

  1. Read the CSV file path from $1
  2. Parse the bank-format CSV
  3. Apply normalization rules
  4. Write to normalized_.csv in same directory
  5. Stop hook validates the output

Usage

/finance-normalize-csv data/raw_checkings.csv

Output: normalized_checkings.csv in the same directory