Beancount Importer for CaixaBank Excel statement exports
Project description
Beancount CaixaBank Importer
beancount-caixabank provides a Beancount importer for converting CaixaBank Excel
statement exports to the Beancount format.
Features
- 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
Installation
pip install beancount-caixabank
Usage
Getting Your CaixaBank Statement
- 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
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.xls
Beancount 2.x
Add the following to your config.py:
from beancount_caixabank import CaixaBankImporter
CONFIG = [
CaixaBankImporter('Assets:CaixaBank:Checking'),
]
Configuration
Account Name
The importer requires you to specify the Beancount account name where transactions will be imported:
CaixaBankImporter('Assets:MyBank:CaixaBank:Main')
Example Configuration
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()
File Format
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.
Development
Prerequisites
- Python 3.9 or higher
- uv - Fast Python package installer and resolver
Setup
-
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
Using a Python environment
If you prefer to use a specific Python version:
uv sync --python 3.11
Testing
The 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 pytest
Or with verbose output:
uv run pytest -v
Contributing
Contributions are welcome! Please feel free to submit a PR.
License
This project is licensed under the MIT License - see the LICENSE.txt file for details.
Disclaimer
This importer is provided as-is. Always verify imported transactions against your bank statements to ensure accuracy.
Support
For issues, questions, or suggestions, please create an issue on the GitHub repository.
Related Projects
- Beancount - Command-line accounting system
- beancount-n26 - N26 bank importer
- beangulp - Beancount importer framework
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file beancount_caixabank-1.0.0.tar.gz.
File metadata
- Download URL: beancount_caixabank-1.0.0.tar.gz
- Upload date:
- Size: 39.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95e69cdef63d5936950d105230f01ba87e961c09e6748d61a15bc210694d4a59
|
|
| MD5 |
32bf3d51f5c00d022257bf383f167267
|
|
| BLAKE2b-256 |
bc8ed04be8f74b71e125746ab8de7e635f3e6300fe276358f32569882eae9276
|
Provenance
The following attestation bundles were made for beancount_caixabank-1.0.0.tar.gz:
Publisher:
publish.yml on rogiia/beancount-caixabank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
beancount_caixabank-1.0.0.tar.gz -
Subject digest:
95e69cdef63d5936950d105230f01ba87e961c09e6748d61a15bc210694d4a59 - Sigstore transparency entry: 789592254
- Sigstore integration time:
-
Permalink:
rogiia/beancount-caixabank@af5c749bc0da2c9ed3f43a603e866ff351379526 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/rogiia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@af5c749bc0da2c9ed3f43a603e866ff351379526 -
Trigger Event:
release
-
Statement type:
File details
Details for the file beancount_caixabank-1.0.0-py3-none-any.whl.
File metadata
- Download URL: beancount_caixabank-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4f29eba8b7fa7021fa247696e1e60dff4414aee216967c106d3fb21c13161ae
|
|
| MD5 |
2a1082987466178d222fc2569d917ed1
|
|
| BLAKE2b-256 |
e956dea4b977d0899c6bf0774579ec6f66360fcf01d53ae5c5d006a385459048
|
Provenance
The following attestation bundles were made for beancount_caixabank-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on rogiia/beancount-caixabank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
beancount_caixabank-1.0.0-py3-none-any.whl -
Subject digest:
d4f29eba8b7fa7021fa247696e1e60dff4414aee216967c106d3fb21c13161ae - Sigstore transparency entry: 789592256
- Sigstore integration time:
-
Permalink:
rogiia/beancount-caixabank@af5c749bc0da2c9ed3f43a603e866ff351379526 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/rogiia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@af5c749bc0da2c9ed3f43a603e866ff351379526 -
Trigger Event:
release
-
Statement type: