A python script to convert an ucompressed Gnucash XML file to a text file for Ledger and hledger.

Overview

README

1 gnucash2ledger

gnucash2ledger is a Python script based on the Github Gist by nonducor (nonducor/gcash2ledger.py). This Python script will take an uncompressed Gnucash file saved in the default XML format and write a text file in a format compatible with John Wiegley’s ledger program (Github: ledger/ledger).

Note: gnucash2ledger will only work if the Gnucash data is saved in an uncompressed XML file. If you prefer to save your Gnucash in SQL database formats, checkout the piecash project.

1.1 Features

gnucash2ledger has the following features:

  • Allows for export to a text file or prints results to standard output
  • Exports commodity definitions, account definitions, and transactions with splits
  • Supports multiple commodities/currencies
  • Provides and option to insert a default header for Emacs ledger-mode (Github: ledger/ledger-mode)
  • Currency codes can be replaced by currency symbols using Python CurrencySymbols library
  • Provides an option to display progress bars (useful for converting very long Gnucash files)

1.2 Usage

gnucash2ledger.py [-h] [-c] [-d DATE_FORMAT] [-e] [-f] [-na] [-nc] [-nt] [-o FILENAME] [-p] [--payee-metadata] [-s] [-v] input

1.2.1 Command Line Arguments

Output from gnucash2ledger -h

positional arguments:
  input                 a Gnucash XML file to be read

optional arguments:
  -h, --help            show this help message and exit
  -c, --cleared         Marks all transactions as cleared and place a cleared (*) mark before the transaction heading.
  -d DATE_FORMAT, --date-format DATE_FORMAT
                        A string representing the desired format of dates in the ledger file. Defaults to the ISO standard format: '%Y-%m-%d'.
  -e, --emacs-header    Adds a default header for ledger-mode in Emacs.
  -f, --force-clobber   Force clobbering of and output file i the file already exists. If this option is provided, the output file will overwrite the existing file
                        with the same name.
  -na, --no-account-defs
                        Prevents output of account definitions to the output file.
  -nc, --no-commodity-defs
                        Prevent output of commodities to the output file.
  -nt, --no-transations
                        Prevent output of transactions to the output file. NOTE: This will cause ledger to throw an error if executed on this file.
  -o FILENAME, --output FILENAME
                        Name of file to store the output results.
  -p, --show-progress   Show script status progress while reading and writing data.
  --payee-metadata      Takes the information entered into the 'Description' field in Gnucash splits and adds them as a tagged '; Payee:' memo for the corresponding
                        transaction split.
  -s, --use-symbols     Replaces currency codes with currency symbols.
  -v, --version         show program's version number and exit

1.3 Requirements

gnucash2ledger requires that the following Python packages are installed:

  • currency-symbols
  • tqdm
Owner
Thomas Freeman
Thomas Freeman
A tool for batch processing large fasta files and accompanying metadata table to upload to repositories via API

Fasta Uploader A tool for batch processing large fasta files and accompanying metadata table to repositories via API The python fasta_uploader.py scri

Centre for Infectious Disease and One Health 1 Dec 09, 2021
Add Ranges and page numbers to IIIF Manifest from a CSV.

Add Ranges and page numbers to IIIF Manifest from CSV specific to a workflow of the Bibliotheca Hertziana.

Raffaele Viglianti 3 Apr 28, 2022
Extract the windows major and minor build numbers from an ISO file, and automatically sort the iso files.

WindowsBuildFromISO Extract the windows major and minor build numbers from an ISO file, and automatically sort the iso files. Features Parse multiple

Podalirius 9 Nov 09, 2022
A python wrapper for libmagic

python-magic python-magic is a Python interface to the libmagic file type identification library. libmagic identifies file types by checking their hea

Adam Hupp 2.3k Dec 29, 2022
Pti-file-format - Reverse engineering the Polyend Tracker instrument file format

pti-file-format Reverse engineering the Polyend Tracker instrument file format.

Jaap Roes 14 Dec 30, 2022
This simple python script pcopy reads a list of file names and copies them to a separate folder

pCopy This simple python script pcopy reads a list of file names and copies them to a separate folder. Pre-requisites Python 3 (ver. 3.6) How to use

Madhuranga Rathnayake 0 Sep 03, 2021
Extract an archive file (zip file or tar file) stored on AWS S3

S3 Extract Extract an archive file (zip file or tar file) stored on AWS S3. Details Downloads archive from S3 into memory, then extract and re-upload

Evan 1 Dec 14, 2021
Kartothek - a Python library to manage large amounts of tabular data in a blob store

Kartothek - a Python library to manage (create, read, update, delete) large amounts of tabular data in a blob store

15 Dec 25, 2022
Powerful Python library for atomic file writes.

Powerful Python library for atomic file writes.

Markus Unterwaditzer 313 Oct 19, 2022
Python package to read and display segregated file names present in a directory based on type of the file

tpyfilestructure Python package to read and display segregated file names present in a directory based on type of the file. Installation You can insta

Tharun Kumar T 2 Nov 28, 2021
This project is a set of programs that I use to create a README.md file.

🤖 codex-readme 📜 codex-readme What is it? This project is a set of programs that I use to create a README.md file. How does it work? It reads progra

Tom Dörr 224 Jan 07, 2023
Small-File-Explorer - I coded a small file explorer with several options

Petit explorateur de fichier / Small file explorer Pour la première option (création de répertoire) / For the first option (creation of a directory) e

Xerox 1 Jan 03, 2022
File-manager - A basic file manager, written in Python

File Manager A basic file manager, written in Python. Installation Install Pytho

Samuel Ko 1 Feb 05, 2022
Python library and shell utilities to monitor filesystem events.

Watchdog Python API and shell utilities to monitor file system events. Works on 3.6+. If you want to use Python 2.6, you should stick with watchdog

Yesudeep Mangalapilly 5.6k Jan 04, 2023
Nintendo Game Boy music assembly files parser into musicxml format

GBMusicParser Nintendo Game Boy music assembly files parser into musicxml format This python code will get an file.asm from the disassembly of a Game

1 Dec 11, 2021
A python script to pull the transactions of an Algorand wallet and put them into a CSV file.

AlgoCSV A python script to pull the transactions of an Algorand wallet and put them into a CSV file. Dependancies: Requests Main features: Groups: Com

21 Jun 25, 2022
Python codes for the server and client end that facilitates file transfers. (Using AWS EC2 instance as the server)

Server-and-Client-File-Transfer Python codes for the server and client end that facilitates file transfers. I will be using an AWS EC2 instance as the

Amal Farhad Shaji 2 Oct 13, 2021
This python project contains a class FileProcessor which allows one to grab a file and get some meta data and header information from it

This python project contains a class FileProcessor which allows one to grab a file and get some meta data and header information from it. In the current state, it outputs a PrettyTable to txt file as

Joshua Wren 1 Nov 09, 2021
A simple file module for creating, editing and saving files.

A simple file module for creating, editing and saving files.

1 Nov 25, 2021
A Certificate renaming tool made for IEEE CS SBC, SJCE.

PDF Batch Renamer Made for IEEE CS SBC, SJCE How to use? Before using the python script, ensure that pytesseract, pdf2image, opencv and other supporti

Ashwin Kumar U 2 Nov 14, 2021