beancount-caixabank provides a Beancount importer for converting CaixaBank Excel
statement exports to the Beancount format.
- Format Support: Handles CaixaBank Excel exports (.xls and .xlsx)
- Robust Parsing:
- Flexible header detection (handles statements with metadata rows)
- Supports both Excel date serial numbers and DD/MM/YYYY string dates
- European number format parsing (comma as decimal, dot as thousands separator)
- Full Beancount Integration: Creates proper transactions with metadata, payee, and narration
pip install beancount-caixabank- Log in to CaixaBank online
- Navigate to your account
- Export statement as Excel file (.xls or .xlsx)
- The file should contain columns: Fecha, Fecha valor, Movimiento, Más datos, Importe, Saldo
Beancount 3.x uses a script-based workflow. Create an import.py file in your Beancount
directory:
from beancount_caixabank import CaixaBankImporter
from beangulp import Ingest
importers = [
CaixaBankImporter('Assets:CaixaBank:Checking'),
]
if __name__ == '__main__':
ingest = Ingest(importers)
ingest()Then run:
python import.py extract path/to/statement.xlsAdd the following to your config.py:
from beancount_caixabank import CaixaBankImporter
CONFIG = [
CaixaBankImporter('Assets:CaixaBank:Checking'),
]The importer requires you to specify the Beancount account name where transactions will be imported:
CaixaBankImporter('Assets:MyBank:CaixaBank:Main')For a typical Beancount 3.x setup:
from beancount_caixabank import CaixaBankImporter
from beangulp import Ingest
importers = [
CaixaBankImporter('Assets:CaixaBank:Checking'),
CaixaBankImporter('Assets:CaixaBank:Savings'),
]
if __name__ == '__main__':
ingest = Ingest(importers)
ingest()CaixaBank Excel statements should contain the following columns:
| Column | Description | Format |
|---|---|---|
| Fecha | Transaction date | DD/MM/YYYY |
| Fecha valor | Value date | DD/MM/YYYY |
| Movimiento | Transaction description/payee | Text |
| Más datos | Additional details/reference | Text |
| Importe | Amount | European format (comma decimal, dot thousands) |
| Saldo | Account balance | European format |
Note: The importer automatically detects the header row, so metadata rows before the headers are handled correctly.
- Python 3.9 or higher
- uv - Fast Python package installer and resolver
-
Clone the repository:
git clone https://github.com/rogiia/beancount-caixabank cd beancount-caixabank -
Install dependencies:
uv sync
-
Run tests:
uv run pytest
-
Run linting:
uv run task lint
If you prefer to use a specific Python version:
uv sync --python 3.11The importer includes comprehensive tests covering:
- File identification and validation
- Single and multiple transaction extraction
- Date parsing (string and Excel formats)
- European number format parsing
- Edge cases and error handling
Run the test suite with:
uv run pytestOr with verbose output:
uv run pytest -vContributions are welcome! Please feel free to submit a PR.
This project is licensed under the MIT License - see the LICENSE.txt file for details.
This importer is provided as-is. Always verify imported transactions against your bank statements to ensure accuracy.
For issues, questions, or suggestions, please create an issue on the GitHub repository.
- Beancount - Command-line accounting system
- beancount-n26 - N26 bank importer
- beangulp - Beancount importer framework