I have what I think may be a very simple CSV file:

Column headers are these:
Date,Description,Amount,Unapplied,Balance 

Corresponding data fields look like this:
Dec 1, 2023,PAYMENT,$951.28,$951.28,$25,000.62

I have had some success using Red's ofx importer framework, but am really 
struggling to figure out the CSV importer from the examples in the git 
repo. I started with the Discover example that looks like this:

from beancount_reds_importers.libreader import csvreader
from beancount_reds_importers.libtransactionbuilder import banking

class Importer(csvreader.Importer, banking.Importer):
    IMPORTER_NAME = """ Discover credit card .csv importer."""

    def custom_init(self):
        self.max_rounding_error = 0.04
        self.filename_pattern_def = 'Discover.*'
        self.header_identifier = 'Trans. Date,Post 
Date,Description,Amount,Category'
        self.date_format = '%m/%d/%Y'
        self.header_map = {
            "Category":    'payee',
            "Description": 'memo',
            "Trans. Date": 'date',
            "Post Date":   'postDate',
            "Amount":      'amount',
            }

    def skip_transaction(self, ot):
        return False

    def prepare_processed_table(self, rdr):
        # Need to invert numbers supplied by Discover
        rdr = rdr.convert('amount', lambda x: -1 * x)
        return rdr

I'm pretty sure I don't need the def skip_transaction(self, ot) and def 
prepare_processed_table(self, rdr): bits, but am at a loss to figure out 
what fields I need to modify in the def custom_init(self) for my situation. 
There is not an example CSV file for that importer in the repo so it makes 
it a little more challenging for me to hack on it. I think I don't need the 
"Unapplied" column but am not sure. Even just some hints would be really 
helpful. 

Thank you in advance!
Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/82615c84-be22-4447-8330-488ad7e55061n%40googlegroups.com.

Reply via email to