Issue #200: Expose csv.Dialect in beancount.ingest.importers.csv.Importer (blais/beancount)

24 views
Skip to first unread message

Johannes Harms

unread,
Nov 12, 2017, 5:30:19 PM11/12/17
to bean...@googlegroups.com
New issue 200: Expose csv.Dialect in beancount.ingest.importers.csv.Importer
https://bitbucket.org/blais/beancount/issues/200/expose-csvdialect-in

Johannes Harms:

I have been playing around with the CSV importer provided in `beancount.ingest.importers.csv.Importer`, trying to import CSV like the following example data mimicking by bank's csv format:

```
DE40100100100000012345;Paying the rent;04.09.2017;04.09.2017;-800,00;EUR
DE40100100100000012345;Transfering accumulated savings to other account;05.09.2017;05.09.2017;-2500,00;EUR
DE40100100100000012345;Payroll;04.09.2017;04.09.2017;2000,00;EUR
```

One specialty of the above CSV is that it uses semicolons instead of commas as column separators. My suggestion is: This could easily be configured by passing a `csv.Dialect` to the beancount csv importer. E.g., by adding an additional parameter to its `__init__` method, as follows

```python
class Importer(regexp.RegexpImporterMixin, importer.ImporterProtocol):

def __init__(self, config, account, currency, regexps,
institution=None,
debug=False,
csv_dialect : Union[str, csv.Dialect] ='excel'):
```

I have tried it out already, which means I can contribute a merge request. (I'll push it in a few minutes).

Responsible: blais
Reply all
Reply to author
Forward
0 new messages