csvledger package

Submodules

csvledger.cli module

csvledger.config module

Provides the configuration for the CSVledger module.

class csvledger.config.Config(config_file=None, profile='default')

Bases: object

Reads the configuration from config file.

Parameters:
  • config_file (str) – File path of config file.
  • profile (str) – Profile name from config file to be used
parse_config(profile)

Reads the config file and imports settings.

Parameters:profile (str) – Profile name from config file to be used

csvledger.csvledger module

class csvledger.csvledger.CSVledger(config_file=None, profile='default')

Bases: object

CSVledger taks the input of a CSV file of financial transactions, strips excessive data from the transactions and then converts the transactions to ledger-cli format.

Parameters:config_file (str) – File path of config file.
categorize_transaction(description)

Matches the transaction description from the accounts and vendors listed in the config file.

Parameters:description (str) – Transaction description
Returns:Account Category associated with description if found.
Return type:str or None
convert_file(csvfile=None, check=False)
Parameters:
  • csvfile (str) – File path of csv file to processed.
  • check (Boolean) – Check for unmatched transactions.
Returns:

converted transactions

Return type:

str

filter_description(description)

Delete extra data from the transaction description which is listed in the config file under filter.

Parameters:description (str) – The description to be filtered
Returns:The filtered description.
Return type:str
static format_date(date)

Converts date from %m/%d/%Y to ledgers default format of ‘%Y/%m/%d’

Parameters:date (str) – Date in %m/%d/%Y (12/15/2019)
Returns:Date formated to ‘%Y/%m/%d’ (2019/12/15)
Return type:str
format_transaction(date, payee, debit=0, credit=0)

Formats transaction into the ledger format.

Parameters:
  • date (str) – date of transactions
  • description (str) – payee of transaction
  • debit (float) – debit amount of transaction
  • credit (float) – credit amount of transaction
Returns:

Formatted transaction

Return type:

str

get_totals()

Returns the combined total of all credit and debit transactions.

Returns:formatted with summed total of all transactions
Return type:str

Module contents