Install and run:

dnf install -y hledger-web


Some tips and tricks I’ve learned when working with hledger.

Get most recent transaction dates

When importing new records from a bank, you might want to check first which is the most recent transaction date; e.g. to find the most recent Amex transaction:

hledger print "Amex" -Ocsv | tail -n 1

Add a transaction manually

hledger add

Importing transactions

Import transactions from a bank:

tac $FD_FILE | head -n-1 | hledger import -f ledger-2021.journal --rules-file mybank.csv.rules -

Show register of transactions

The register shows all the details of transactions:

$ hledger register
2020/01/02 Tesco Store London               Expenses:Groceries                      17.72         17.72
                                            Li:Credit Card:Amex Gold               -17.72             0
2020/01/02 Pure London                      Expenses:Groceries                       2.40          2.40
                                            Li:Credit Card:Amex Gold                -2.40             0

Show pending transactions

Show uncleared transactions (e.g. I use this for expense transactions which are awaiting reimbursement):

hledger register -P

To print transactions since a date, in valid hledger journal format:

hledger print --begin=2020/04/06

Show balances as of a given date (useful for reconciling)

Show balances up to 2015-01-01:

hledger bal date:-2015/01/01

Useful output for reconciling:

$ hledger reg MyBank
2020-09-26 Exmouth Coffee Company          Liabilities:Credit Card:MyBank       £ -2.50     £ -703.30
2020-09-28 DIRECT DEBIT PAYMENT -          Liabilities:Credit Card:MyBank      £ 442.72     £ -260.58
2020-09-28 Spotify UK                      Liabilities:Credit Card:MyBank       £ -9.99     £ -270.57
2020-10-01 Google GSuite                   Liabilities:Credit Card:MyBank       £ -4.97     £ -275.54
hledger register current --historical date:2020/09/20-2020/10/19


Monthly report showing all categories under “Expenses” by month:

hledger balance -MA --depth 2 Expenses

Show income and expense statement for this year:

hledger incomestatement -MA -b $YEAR

hledger UI

Run the UI:

podman run --rm -e HLEDGER_JOURNAL_FILE=/data/ledger-2021.journal -v "$(pwd):/data:Z" -p 5000:5000 dastapov/hledger


Sample hledger rules file for First Direct

Export a CSV from First Direct, then:

# skip the first CSV line (headings)
#skip 1

# define the fields to use from each CSV record
fields   date, description, amount

# prepend £ to CSV amounts
# currency £

# date is in UK/Ireland format
date-format  %d/%m/%Y

# always set the transaction FROM lloyds card TO uncategorised
account1 Assets:Current Account
account2 Expenses:Uncategorised

  account2 Expenses:Home:Internet
  account2 Expenses:Home:TV
  account2 Expenses:Home:Rent


well-formed but invalid date when importing a CSV

Problem with hledger 1.18.1:

  • hledger import expects the import file to end with .csv. If it does not, hledger seems to ignore your custom CSV rules file.
  • Workaround: make sure the file you are importing is in a physical file on disk, and that it ends with .csv.
  • Example command: hledger import --rules-file fd.rules --dry-run --debug=9 $CSV_FILE.modded.csv