beancount / beangulp

Importers framework for Beancount
GNU General Public License v2.0
61 stars 24 forks source link

ING Bank NL how to start with import #119

Open jpduyx opened 1 year ago

jpduyx commented 1 year ago

I'm trying to get started with beancount (v2) and figured that beangulp is probably the best / future way for importers?

I'm in the Netherlands and would like to start with importing my ING Bank account. I found an importer online for ING DiBa in germany, or Rabobank NL but those don't match the format of my files.

We (or at least I in my account) can download 4 different formats:

  1. csv (ssv)- semicolon delimiter (including field: tag and field: Balance after Transaction
  2. csv - comma delimited
  3. pdf file 2 options: ascending or descending
  4. csv - comma delimited - only balance statements

It looks like 1 semicolon delimited csv (ssv) file is probalby the newest and includes "Tags" (i guess I can add a tag to a transaction using eg my banking app on my phone) and also has a field for "Balance after transaction", which i guess both can be handy. So lets focus on this one.

It is possible to download all (payment / checking) accounts in one csv file (not for PDF). Each file can contain many years or a shorter time period of choice.

It is also possible to download a CSV (not ssv) for a connected savings account. But I don't see the use of this as I can only withdraw to the main account anyway, so any transactions will pass that file already.

By trial and error I found there can be an english language header in the downloaded semicolon separated file or a dutch language header ... depending on your personal settings for the website itself (mijn.ing.nl). It would be great to avoid convusion and be able to use multiple headers languages also in the importer.

Some other things:

My questions

Is it possible to use a generic CSV import module for this kind of ssv / csv file? Then where can I find an example how to set the Amount negative depending on the value in "Debit / credit" field, and set the decimal Delimiter to ","?

I only found an example where Debit / Credit amounts each has their own column

If not possible, what would be the best way to proceed? Invent the wheel and write a new importer, or is it possible to inherit from a generic CSV importer and add the required logic?

Or is it preferred to add this logic to the generic CSV importer for others to be able to use it in similar situations?

Based on Name / Description or "TheirIBAN" field alone it would in many cases be possible to match with a Ledger Account name ... in some cases the invoice number or some other number can be found in the "Notifications" field ... which could be used to match more precisely ... but i would first like to be able to read the CSV file and make simple matches.

Where should I start?

See attached a curated example of the ssv format ... hope my curating hasn't didn't change the original file too much... i had to repair lost quotes and changed date formatting after checking the file in LibreOffice and saving it back ...

IBAN_dd-mm-yyyy_dd-mm-yyy.csv

Thank you

ThomasdenH commented 7 months ago

Hi! Did you find an answer yet?

Did you have a look at the examples, such as this one?

To handle the 'Af' en 'Bij' situation, I would add two columns:

amount = csvbase.Amount('Af')
bij = csvbase.Amount('Bij')

After that you can override finalize to actually use these columns and change the amount to be Af - Bij (or should those be reversed?). I have a more complex example that overrides finalize in my own importers repository.