# Comptabilité Scripts This repository contains Python scripts to process financial statements from various banks and financial institutions, extract transaction data, and categorize expenses. ## Features - Processes PDF and CSV financial statements from multiple sources - Categorizes transactions automatically based on descriptions - Generates expense summaries with percentages - Optional CSV output for all transactions (new feature) - Support for Boursobank, American Express, Monabanq, Revolut, SNCF, and La Poste ## Scripts Overview ### Main Scripts 1. **process_bourso.py** - Processes Boursobank account statements 2. **process_amex.py** - Processes American Express credit card statements 3. **process_monabanq.py** - Processes Monabanq account statements 4. **process_expenses.py** - Processes Revolut account statements (CSV format) 5. **process_sncf.py** - Processes SNCF salary statements 6. **process_laposte.py** - Processes La Poste (CCP) account statements ### Master Script - **process_all.py** - Master script that runs all processing scripts with unified options ## Usage ### Individual Scripts Each script can be run with optional CSV output: ```bash # Process without CSV output python process_bourso.py # Process with CSV output python process_bourso.py --csv # Process all PDFs in a specific directory python process_bourso.py --pdf-dir /path/to/pdfs --csv ``` ### Master Script The master script can process all statements at once: ```bash # Process all statements python process_all.py # Process all statements with CSV output python process_all.py --csv # Process only specific accounts python process_all.py --bourso --amex --csv ``` ## Output When run with `--csv` flag, each script generates: - Individual CSV files for each input file (when applicable) - A consolidated CSV file containing all transactions The CSV files include: - Date - Description - Category - Amount/Debit/Credit - Source file ## Requirements - Python 3.6+ - pdftotext utility (for PDF processing) - Required Python packages: csv, subprocess, re, os, glob, collections ## Installation 1. Install pdftotext: ```bash # Ubuntu/Debian sudo apt-get install poppler-utils # macOS brew install poppler # Windows # Download from https://github.com/xfftt/poppler-windows/releases/ ``` 2. Clone or download this repository ## CSV Export Feature (New) The scripts now support exporting all transaction data to CSV format. This allows for: - Further analysis in spreadsheet applications - Data archiving - Integration with other financial tools - Transaction-level review and editing To enable CSV export, add the `--csv` flag when running any script. ## Git Repository This is now a Git repository. To start tracking changes: ```bash git add . git commit -m "Initial commit with CSV export functionality" ``` ## File Structure ``` comptabilite/ ├── .gitignore ├── process_bourso.py ├── process_amex.py ├── process_monabanq.py ├── process_expenses.py ├── process_sncf.py ├── process_laposte.py ├── process_all.py ├── README.md ├── 1-sncf/ ├── 2-la.poste/ ├── american.express/ ├── boursobank/ ├── monabanq/ └── revolut/ ```