#ledger #format #csv #accounting #format-file #import #convert

bin+lib okane

CLI tool to support Ledger (https://www.ledger-cli.org/) usecases. Curently it provides import feature.

13 releases (7 breaking)

0.9.0 May 12, 2024
0.8.0 Feb 3, 2024
0.7.0 Nov 16, 2023
0.6.0 Apr 14, 2023
0.1.0 Nov 26, 2021

#27 in Finance

Download history 134/week @ 2024-02-16 41/week @ 2024-02-23 8/week @ 2024-03-01 2/week @ 2024-03-08 1/week @ 2024-03-15 59/week @ 2024-03-29 13/week @ 2024-04-05 150/week @ 2024-05-10 15/week @ 2024-05-17 3/week @ 2024-05-24

168 downloads per month

MIT license

260KB
6.5K SLoC

okane

CircleCI crates.io

Rust based plain text accounting software, influenced by ledger.

Currently this software is developed just to meet author personal needs, and implementing two features.

  • format is to format given Ledger file into organized format.
  • import is to convert various source including CSV, ISO Camt053 XML into Ledger format.

How to use

Disclaimer: This software is still in early phase, subject to any kind of change.

Format the file

cargo build
RUST_LOG=info ./target/debug/okane format ~/ledger/account.ledger

This command currently prints the formatted output into standard output. I'll work to replace the files in-place, also to emit diffs to be used as Git hook.

Import CSV or ISO Camt053 XML files

First you need to write YAML file to control import behavior. We'll assume those are placed under ~/ledger/. The format of YAML is (sorry) not documented, but you can see tests/testdata directory for example configuration.

Then run the okane import command with logging and redirecting to /dev/null. This way you can check unhandled entries.

$ cargo build
$ RUST_LOG=info ./target/debug/okane import --config ~/ledger/import.yml ~/ledger/input_file.csv > /dev/null

After iterating over the logs and modifying YAML file, you can redirect the standard output to the ledger file.

$ cargo build
$ RUST_LOG=info ./target/debug/okane import --config ~/ledger/import.yml ~/ledger/input_file.csv >> ~/ledger/output_path.ledger

Tips: You probably don't want to handle all the entries, rather should aim to cover 80-90% of entries initially.

Dependencies

~16MB
~340K SLoC