Skip to content

Converter form .csv format to .ledger file for use with Ledger CLI

License

Notifications You must be signed in to change notification settings

KM-Kinter/ledger-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ledger-converter

Converter from .csv format file to .ledger file to use with Ledger CLI

Usage:

  1. Enter path to yours .csv format file:

Attention! Do not enter path like ~/Downloads/something.csv instead of this use:

MacOS: /Users/user/Downloads/something.csv

Windows: C:\\Users\\User\\Downloads\\something.csv

  1. The script converts the CSV into a Ledger-compatible .ledger file in the current directory (transactions.ledger).
  2. If you want to save .ledger file to custom directory then add the following to your code:

In function def convert_csv_to_ledger(input_csv): output_ledger = os.path.join(output_dir, "transactions.ledger")

At the end of file: output_dir = input("Enter the directory to save the Ledger file: ").strip()

Notes:

The script maps the transaction types to Ledger accounts. You can customize the account mappings in the map_account function.

The script writes transactions with debit and credit entries, and includes a memo if provided.

About

Converter form .csv format to .ledger file for use with Ledger CLI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages