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
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
Convert All TXT Files To One File.

AllToOne Convert All TXT Files To One File. Hi 👋 , I'm Alireza A Python Developer Boy 🔭 I’m currently working on my C# projects 🌱 I’m currently Lea

4 Jun 07, 2022
Object-oriented file system path manipulation

path (aka path pie, formerly path.py) implements path objects as first-class entities, allowing common operations on files to be invoked on those path

Jason R. Coombs 1k Dec 28, 2022
MetaMove is written in Python3 and aims at easing batch renaming operations based on file meta data.

MetaMove MetaMove is written in Python3 and aims at easing batch renaming operations based on file meta data. MetaMove abuses eval combined with f-str

Jan Philippi 2 Dec 28, 2021
dotsend is a web application which helps you to upload your large files and share file via link

dotsend is a web application which helps you to upload your large files and share file via link

Devocoe 0 Dec 03, 2022
CSV-Handler written in Python3

CSVHandler This code allows you to work intelligently with CSV files. A file in CSV syntax is converted into several lists, which are combined in a to

Max Tischberger 1 Jan 13, 2022
A platform independent file lock for Python

py-filelock This package contains a single module, which implements a platform independent file lock in Python, which provides a simple way of inter-p

Benedikt Schmitt 497 Jan 05, 2023
CleverCSV is a Python package for handling messy CSV files.

CleverCSV is a Python package for handling messy CSV files. It provides a drop-in replacement for the builtin CSV module with improved dialect detection, and comes with a handy command line applicati

The Alan Turing Institute 1k Dec 19, 2022
Copy only text-like files from the folder

copy-only-text-like-files-from-folder-python copy only text-like files from the folder This project is for those who want to copy only source code or

1 May 17, 2022
A small Python module for determining appropriate platform-specific dirs, e.g. a "user data dir".

the problem What directory should your app use for storing user data? If running on macOS, you should use: ~/Library/Application Support/AppName If

ActiveState Software 948 Dec 31, 2022
ValveVMF - A python library to parse Valve's VMF files

ValveVMF ValveVMF is a Python library for parsing .vmf files for the Source Engi

pySourceSDK 2 Jan 02, 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
This is a file deletion program that asks you for an extension of a file (.mp3, .pdf, .docx, etc.) to delete all of the files in a dir that have that extension.

FileBulk This is a file deletion program that asks you for an extension of a file (.mp3, .pdf, .docx, etc.) to delete all of the files in a dir that h

Enoc Mena 1 Jun 26, 2022
A simple Python code that takes input from a csv file and makes it into a vcf file.

Contacts-Maker A simple Python code that takes input from a csv file and makes it into a vcf file. Imagine a college or a large community where each y

1 Feb 13, 2022
A simple library for temporary storage of small files

TemporaryStorage An simple library for temporary storage of small files. Navigation Install Usage In Python console As a standalone application List o

2 Apr 17, 2022
Python's Filesystem abstraction layer

PyFilesystem2 Python's Filesystem abstraction layer. Documentation Wiki API Documentation GitHub Repository Blog Introduction Think of PyFilesystem's

pyFilesystem 1.8k Jan 02, 2023
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
File storage with API access. Used as a part of the Swipio project

API File storage File storage with API access. Used as a part of the Swipio project 📝 About The Project File storage allows you to upload and downloa

25 Sep 17, 2022
OneDriveExplorer - A command line and GUI based application for reconstructing the folder strucure of OneDrive from the UserCid.dat file

OneDriveExplorer - A command line and GUI based application for reconstructing the folder strucure of OneDrive from the UserCid.dat file

Brian Maloney 100 Dec 13, 2022
Find potentially sensitive files

find_files Find potentially sensitive files This script searchs for potentially sensitive files based off of file name or string contained in the file

4 Aug 20, 2022