Can't get csv importer to work

73 views
Skip to first unread message

Alvin Ye

unread,
May 8, 2022, 2:48:25 AM5/8/22
to Beancount
Hello,

My _config.py:

amex_cc_importer = CSVImporter({
    Col.DATE: 'Date',
    Col.NARRATION1: 'Description',
    Col.AMOUNT: 'Amount',
    },
    "Liabilities:Amex-Card",
    'USD',
   ('Date,Description,Amount,Balance'),
    skip_lines=0
    )

CONFIG= [amex_cc_importer]

activity.csv:
Date,Description,Card Member,Account #,Amount,Extended Details,Appears On Your Statement As,Address,City/State,Zip Code,Country,Reference,Category...

I couldn't get bean-identify to associate my importer with activity.csv, and any help would be much appreciated.

Thanks,
Alvin

Martin Michlmayr

unread,
May 8, 2022, 3:48:47 AM5/8/22
to bean...@googlegroups.com
* Alvin Ye <alvin...@gmail.com> [2022-05-07 23:27]:
> ('Date,Description,Amount,Balance'),

This does not match your CSV file.

> activity.csv:
> Date,Description,Card Member,Account #,Amount,Extended Details,Appears On

--
Martin Michlmayr
https://www.cyrius.com/

Alvin Ye

unread,
May 8, 2022, 5:55:50 PM5/8/22
to Beancount
Thank you for the reply. I change my config but still the same result. I'm using beancount 2.3.5

new config:

from beancount.ingest.importers.csv import Importer as CSVImporter, Col


amex_cc_importer = CSVImporter({
    Col.DATE: 'Date',
    Col.NARRATION1: 'Description',
    Col.AMOUNT: 'Amount',
    },
    "Liabilities:Amex:PlatinumCard",
    'USD',
    ('Date,Description,Card Member'),
    skip_lines=0
    )

CONFIG= [amex_cc_importer]

-Alvin

Alvin Ye

unread,
May 22, 2022, 8:26:32 PM5/22/22
to Beancount
I found my issue. Windows use 'application/vnd.ms-excel' as the MIME type for .csv files for god knows why.
Either change line 176 of beancount\ingest\importers\csv.py or copy paste it into your own importer file and change it there.
Reply all
Reply to author
Forward
0 new messages