Code examples for parsing USA bank statement PDFs to Excel/CSV.
- Chase — 3 formats (2015-2017, 2018-2023, 2024+)
- Bank of America — Checking, Savings, Credit Card
- Wells Fargo — Checking, Savings, Credit Card
- Capital One — Checking, Savings, Credit Card
Banks limit CSV downloads (Chase: 18 months, Wells Fargo: 12 months). For historical data (5+ years), you need to parse PDF statements.
Generic PDF tools (Tabula, PDFTables) achieve ~70% accuracy because:
- Multiple format versions per bank
- No headers in some PDFs
- Column positions vary by format and year
function detectChaseFormat(text: string): 'v1' | 'v2' | 'v3' {
// Priority 1: Check for v2 signature
if (text.includes('TRANSACTION DETAIL')) return 'v2';
// Priority 2: Check for v3 signature
if (text.includes('DEPOSITS AND ADDITIONS')) return 'v3';
// Priority 3: Fallback to v1
return 'v1';
}
Extract Text with pdfjs-dist
import * as pdfjsLib from 'pdfjs-dist';
async function extractText(pdfPath: string): Promise<string> {
const doc = await pdfjsLib.getDocument(pdfPath).promise;
let fullText = '';
for (let i = 1; i <= doc.numPages; i++) {
const page = await doc.getPage(i);
const content = await page.getTextContent();
const text = content.items.map(item => item.str).join(' ');
fullText += text + '\n';
}
return fullText;
}
Full Solution
For production-ready parsing with 99% accuracy across all 4 banks:
https://bank-parser.com/?utm_source=github&utm_medium=referral&utm_campaign=readme
- 99% accuracy (tested on 500+ PDFs)
- Chase, Bank of America, Wells Fargo, Capital One
- Checking, Savings, and Credit Card statements
- All formats 2009-2025
- QuickBooks-ready 17-field Excel output
- Free trial: 200 operations
Tech Stack
- Node.js + TypeScript
- pdfjs-dist (Mozilla PDF.js)
License
MIT