Parse Fixed-Width Bank Statement Files
Extract transaction data from fixed-width bank statement formats into CSV. Covers debit/credit columns, date fields, and balance tracking.
Legacy Formats
Detailed Explanation
Bank Statement Fixed-Width Format
Many financial institutions export transaction data in fixed-width formats. These files follow strict layouts defined by banking standards, with each field occupying exact character positions.
Typical Bank Statement Layout
2024-01-15Grocery Store Purchase 45.99 1,234.01
2024-01-16Direct Deposit 2,500.00 3,734.01
2024-01-17Electric Bill Payment 125.50 3,608.51
2024-01-18ATM Withdrawal 200.00 3,408.51
Column Definitions
| Field | Width | Alignment | Notes |
|---|---|---|---|
| Date | 10 | Left | YYYY-MM-DD format |
| Description | 40 | Left | Transaction description |
| Debit | 12 | Right | Amount debited |
| Credit | 12 | Right | Amount credited |
| Balance | 12 | Right | Running balance |
CSV Output
Date,Description,Debit,Credit,Balance
2024-01-15,Grocery Store Purchase,45.99,,1,234.01
2024-01-16,Direct Deposit,,2,500.00,3,734.01
2024-01-17,Electric Bill Payment,125.50,,3,608.51
2024-01-18,ATM Withdrawal,200.00,,3,408.51
Common Challenges
- Empty debit/credit fields: When a transaction is a credit, the debit field is blank (all spaces), and vice versa. Trimming produces an empty string, which translates to an empty CSV field
- Comma-formatted numbers: Some formats include commas in amounts (e.g.,
1,234.56). The CSV escaping will handle this by quoting the field - Multi-line descriptions: Some statements wrap long descriptions. These need to be handled as a separate pre-processing step
- Header and footer rows: Banks often include header/footer lines that should be removed before conversion
Use Case
Importing bank transaction data into accounting software, personal finance apps, or spreadsheets for budgeting and reconciliation.