This tool fetches account data from the API, separates it into assets and liabilities, formats balances using ISO 4217 standards, exports the results to CSV files, and optionally sends these files via email.
The tool can read configuration from command-line flags or from a .env file (default .env in the working directory).
- Go environment: Ensure Go (version 1.16 or higher) is installed.
- SMTP Server Access: If using email, you must have access to a valid SMTP server (Gmail, Outlook, or a dedicated server) and credentials.
- Optional .env file: Stores API credentials, SMTP details.
Example .env file:
# API credentials
BASE_URL=https://api.example.com
LOGIN_NAME=admin
PASSWORD="My#SecretPassword"
# Email configuration
EMAIL_TO="recipient@example.com,spouse@example.com"
EMAIL_MESSAGE="<p>Here is your <b>monthly</b> report.</p>"
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=myemail@gmail.com
SMTP_PASS="my#app_password"
SMTP_FROM=myemail@gmail.com
# PDF configuration
PDF_PASSWORD="SecretFilePassword"
⚠️ Note: If a value contains#, spaces, or$, wrap it in quotes (single'or double").
You can either run it directly using go run or build a standalone binary:
go run main.goor
go build -o ezbookkeeping_tools main.go
./ezbookkeeping_toolsBy default, the tool attempts to load .env if command-line flags are missing. You can specify a custom config file:
./ezbookkeeping_tools -config /path/to/custom.env- Structure: Recursively discovers subaccounts and displays them as
Subaccount (Parent). - Filtering: Excludes parent containers and zero-balance accounts.
- Format: Generates a password-protected PDF attachment.
- Styling: Modern design with colored headers, zebra-striped rows, and color-coded balances (Green/Red).
- Content: Full details including Name, Currency, Balance, Category, and wrapping Comments.
- Multiple Recipients: Supports comma-separated email addresses.
- Custom Message: Allows a custom HTML body message via flag/env.
- Safe Testing: Use
--dry-runto generate the PDF and verify logic without sending any emails.
| Flag | Type | Description | Required | Example |
|---|---|---|---|---|
| -url | string | Base URL of the API. | Yes* | -url "https://api.example.com" |
| -user | string | Login name for API authorization. | Yes* | -user "john.doe" |
| -pass | string | Password for API authorization. | Yes* | -pass "S3cr3tP@ssw0rd" |
| -debug | boolean | Enable detailed HTTP request/response logging. | No | -debug |
| boolean | Print CSV data to console. | No | ||
| -dry-run | boolean | Generate PDF but skip sending email. | No | -dry-run |
| -email-to | string | Comma-separated recipient email addresses. | No | -email-to "me@corp.com,boss@corp.com" |
| -email-message | string | Custom HTML message for the email body. | No | -email-message "Here is the report" |
| -smtp-host | string | SMTP server hostname. | No | -smtp-host "smtp.gmail.com" |
| -smtp-port | int | SMTP server port (default 587). | No | -smtp-port 587 |
| -smtp-user | string | SMTP username. | No | -smtp-user "myemail@gmail.com" |
| -smtp-pass | string | SMTP password. | No | -smtp-pass "app_password" |
| -smtp-from | string | Email sender address. Defaults to SMTP username. | No | -smtp-from "sender@example.com" |
| -pdf-password | string | Password to encrypt the PDF report. | No | -pdf-password "FileSafe123" |
| -config | string | Path to a configuration file (default .env). |
No | -config "./myconfig.env" |
*Required if not provided via
.env.
Generates the PDF report but skips sending email.
go run main.go --dry-runFetches data, generates PDF, and sends it to multiple recipients.
go run main.go \
-url "https://api.example.com" \
-user "admin" \
-pass "secret" \
-email-to "me@example.com,spouse@example.com" \
-smtp-host "smtp.gmail.com" \
-smtp-user "me@gmail.com" \
-smtp-pass "app_password"Sends a report with a custom HTML body.
go run main.go \
--email-to "me@example.com" \
--email-message "Here is your <b>monthly</b> financial summary." \
[other flags...]Protects the generated PDF with a password.
go run main.go \
--pdf-password "MySecretFiles" \
[other flags...]Upon successful execution, the following files are created:
Financial_Report_YYYY-MM-DD.pdf(The main report)assets.csvliabilities.csv