Beancount importer for Zenmoney exports
Project description
beancount-zenmoney
A Beancount importer for Zenmoney CSV exports, built on beangulp.
Installation
pip install beancount-zenmoney
Or with uv:
uv add beancount-zenmoney
Requirements
- Python 3.10+
- Beancount 3.x
- beangulp
Quick Start
Create an import.py file for beangulp (see examples/import.py for a complete example):
from beancount_zenmoney import ZenMoneyImporter
account_map = {
"PKO - PLN": "Assets:Bank:PKO:PLN",
"Revolut - EUR": "Assets:Bank:Revolut:EUR",
}
category_map = {
"Salary": "Income:Salary",
"Food / Groceries": "Expenses:Food:Groceries",
}
importers = [
ZenMoneyImporter(
account_map=account_map,
category_map=category_map,
),
]
Run with beangulp:
beangulp extract -e ledger.beancount import.py zenmoney_export.csv
Configuration Options
ZenMoneyImporter(
# Required: Map Zenmoney account names to Beancount accounts
account_map={
"Bank - PLN": "Assets:Bank:PLN",
},
# Optional: Map Zenmoney categories to Beancount accounts
category_map={
"Food": "Expenses:Food",
},
# Optional: Base account for the importer (default: "Assets:ZenMoney")
base_account="Assets:Import:ZenMoney",
# Optional: Default expense account for unknown categories
default_expense="Expenses:Unknown",
# Optional: Default income account for unknown categories
default_income="Income:Unknown",
# Optional: Default asset account for unknown Zenmoney accounts
default_account="Assets:Unknown",
# Optional: Transaction flag - "*" for cleared (default), "!" for pending
flag="!",
)
Features
Transaction Types
| Zenmoney Transaction | Beancount Result |
|---|---|
| Expense (outcome only) | Debit from asset, credit to expense |
| Income (income only) | Credit to asset, debit from income |
| Transfer (same currency) | Debit from source, credit to destination |
| Currency exchange | Debit in one currency, credit in another with price |
| Refund | Credit to asset, debit from expense |
Currency Exchange with Price
Currency exchanges automatically include price annotations for proper cost tracking:
2025-12-12 * "" "FX EXCHANGE EUR/PLN 4.25"
Assets:Bank:PKO:PLN -4250.00 PLN
Assets:Bank:PKO:EUR 1000.00 EUR @ 4.25 PLN
Metadata Preservation
Each transaction includes metadata from ZenMoney:
2025-12-14 * "SuperMarket" ""
zenmoney_created: "2025-12-14 10:30:00"
zenmoney_changed: "2025-12-14 11:00:00"
zenmoney_category: "Food / Groceries"
Assets:Bank:PKO:PLN -125.50 PLN
Expenses:Food:Groceries 125.50 PLN
File Archiving Support
The importer implements date() and filename() methods for beangulp archiving:
# Archive files with automatic date-based naming
beangulp archive -e ledger.beancount import.py zenmoney_export.csv
# Creates: documents/Assets/Import/ZenMoney/2025-11-29-to-2025-12-15.zenmoney.csv
Logging
Skipped rows are logged as warnings for troubleshooting:
import logging
logging.basicConfig(level=logging.WARNING)
Exporting from Zenmoney
- Open the Zenmoney app or web interface
- Go to Menu → Export
- Select CSV format
- Choose the date range for export
- Download the CSV file
The CSV file should have semicolon-separated columns including:
date,categoryName,payee,commentoutcomeAccountName,outcome,outcomeCurrencyShortTitleincomeAccountName,income,incomeCurrencyShortTitlecreatedDate,changedDate
Example Output
Expense transaction:
2025-12-14 * "SuperMarket" ""
Assets:Bank:PKO:PLN -125.50 PLN
Expenses:Food:Groceries 125.50 PLN
Internal transfer:
2025-12-11 * "" ""
Assets:Bank:PKO:PLN -2000.00 PLN
Assets:Cash:PLN 2000.00 PLN
Income transaction:
2025-12-15 * "ACME CORP" "DECEMBER SALARY"
Assets:Bank:PKO:PLN 15000.00 PLN
Income:Salary -15000.00 PLN
Development
Setup
git clone https://github.com/MrLokans/beancount-zenmoney.git
cd beancount-zenmoney
make install
Releasing
The package is automatically published to PyPI when a version tag is pushed:
make release VERSION=0.2.0
This script will:
- Run all checks (lint, format, typecheck, tests)
- Validate the version format and ensure the tag doesn't exist
- Update version in
pyproject.tomland__init__.py - Commit, tag, and push to remote
Available Commands
make install # Install dependencies
make test # Run tests
make lint # Run linter
make format # Format code (ruff check --fix + ruff format)
make typecheck # Run type checker
make check # Run all checks (lint, format-check, typecheck, test)
make build # Build package
make clean # Clean build artifacts
make release VERSION=X.Y.Z # Create and push a release
Running Tests
make test
Tests use pytest with fixtures for sample CSV data. Test coverage is reported automatically.
License
MIT License - see LICENSE for details.
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_zenmoney-0.1.1a1.tar.gz.
File metadata
- Download URL: beancount_zenmoney-0.1.1a1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48af15adf37f5b4f48cb82ceb8589938e422e677e9354a3b2be0318253b47520
|
|
| MD5 |
09d5a6646b6cf4c81c77a7ca4bc5029f
|
|
| BLAKE2b-256 |
b066c437de334ef77b7c542e3cd37c31b25d01163e09ec52ea0119a4cc8c0a0d
|
Provenance
The following attestation bundles were made for beancount_zenmoney-0.1.1a1.tar.gz:
Publisher:
publish.yml on MrLokans/beancount-zenmoney
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
beancount_zenmoney-0.1.1a1.tar.gz -
Subject digest:
48af15adf37f5b4f48cb82ceb8589938e422e677e9354a3b2be0318253b47520 - Sigstore transparency entry: 790490579
- Sigstore integration time:
-
Permalink:
MrLokans/beancount-zenmoney@731515cef55e45bf585e96ebd37cffb5d7bd9839 -
Branch / Tag:
refs/tags/v0.1.1a1 - Owner: https://github.com/MrLokans
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@731515cef55e45bf585e96ebd37cffb5d7bd9839 -
Trigger Event:
push
-
Statement type:
File details
Details for the file beancount_zenmoney-0.1.1a1-py3-none-any.whl.
File metadata
- Download URL: beancount_zenmoney-0.1.1a1-py3-none-any.whl
- Upload date:
- Size: 6.7 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 |
d22ff2e0c88c7dc08606b987099a64e730d4a63041887e43d193230eb62d823f
|
|
| MD5 |
98fb3d74dec3a865d51b414a07be1102
|
|
| BLAKE2b-256 |
e05a6fed8491b4fe8905aa769ed512966f60a76e78cadc9880eaab3c6aee992b
|
Provenance
The following attestation bundles were made for beancount_zenmoney-0.1.1a1-py3-none-any.whl:
Publisher:
publish.yml on MrLokans/beancount-zenmoney
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
beancount_zenmoney-0.1.1a1-py3-none-any.whl -
Subject digest:
d22ff2e0c88c7dc08606b987099a64e730d4a63041887e43d193230eb62d823f - Sigstore transparency entry: 790490580
- Sigstore integration time:
-
Permalink:
MrLokans/beancount-zenmoney@731515cef55e45bf585e96ebd37cffb5d7bd9839 -
Branch / Tag:
refs/tags/v0.1.1a1 - Owner: https://github.com/MrLokans
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@731515cef55e45bf585e96ebd37cffb5d7bd9839 -
Trigger Event:
push
-
Statement type: