Skip to main content

ynab-memo-parser

GitHub Release Github Release

This library helps you to use original memo and payee information from your bank transactions to either show additional details or substitute/change the current one in YNAB. It can be helpful for cases in which YNAB import does not handle the information coming from the bank well (e.g. not showing the actual bank memo or populating a wrong payee name).

"Buy Me A Coffee"

Preparations

  1. Create a personal access token for YNAB as described here
  2. Get the IDs of your budget and account which records are faulty. You can find both IDs if you go to https://app.ynab.com/ and open the target account by clicking on the name on the left hand side menu. The URL does now contain both IDs https://app.ynab.com/<budget_id>/accounts/<account_id>

Basic Usage

1. Install library from PyPI

pip install ynab-memo-parser

2. Check your original memo and payee values for potential things to use

All records in YNAB come with their original memo and payee information attached. You can see both values if you use the `fetch records' function of this library and look at a couple sample records.

from ynabmemoparser import YnabMemoParser

ynab_memo_parser = YnabMemoParser(token='<token>', budget='<budget>', account='<account>')
ynab_memo_parser.fetch_record_dicts()

You will get back a dictionary with all data stored for the transaction. The library uses the following keys with the stated labels

  • import_payee_name_original as original_memo
  • import_payee_name as original_payee
  • payee as current_payee
  • memo as current_memo

3. Create a Parser child class which implements your logic

The class needs to implement a logic for parse_payee() and parse_memo() based on the values coming from the four fields above. If you don't want to change anything in the field you e.g. just return current_payee inside the parse_payee() function.

from ynabmemoparser import Parser

class MyParser(Parser):

    def parse_payee(self, original_payee: str, current_payee: str, original_memo: str, current_memo: str) -> str:
        # your implementation

    def parse_memo(self, original_payee: str, current_payee: str, original_memo: str, current_memo: str) -> str:
        # your implementation

3. Test your parser on some records

from ynabmemoparser import YnabMemoParser

ynab_memo_parser = YnabMemoParser(token='<token>', budget='<budget>', account='<account>')
record_dicts = ynab_memo_parser.fetch_record_dicts()
parsed_records = ynab_memo_parser.parse_records(records_dicts=record_dicts, parser=MyParser())

You will get back a list of YnabRecord objects. Check the payee and memo fields in these objects to see the result of your parser.

4. Update your records in YNAB

If you are satisfied with your parsing results you can pass the list of YnabRecord to the update_records()function. It will update the payeeand memo values in YNAB with the values in the YnabRecord object

ynab_memo_parser.update_records(parsed_records)

If the insert is successful you get back an integer with the number of records which have been updated.

Metadata

Release files for ynab-memo-parser 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ynab-memo-parser 0.1.0
File Size Uploaded
ynab_memo_parser-0.1.0.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ynab-memo-parser 0.1.0
File Interpreter ABI Platform
ynab_memo_parser-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.2 kB

Release files / ynab_memo_parser-0.1.0.tar.gz

Download URL ynab_memo_parser-0.1.0.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fe29fb986430362ff8e48af0f69e275573f93bc79043b16610e6e3b18529bc35
BLAKE2b-256 checksum
How to use checksums
e9c31f66008f91bdbfb4220bf64e71756813c7d4f851df17dbf81189ffb22207
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.1 CPython/3.12.2 Linux/6.2.0-1019-azure

Release files / ynab_memo_parser-0.1.0-py3-none-any.whl

Download URL ynab_memo_parser-0.1.0-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9e1a8e24a6cd57b76c3c21c01811aef919a5876bf9bd323d1431c7c80b03c01
BLAKE2b-256 checksum
How to use checksums
b322639828b2096e300dcfc14484935d383c833dae58cb5c1accb552ac115435
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.1 CPython/3.12.2 Linux/6.2.0-1019-azure

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page