HowTo support arbitrary CSV formats

#bankstatement #howto

Using the example of the new csv format file csv-standard-bank-na.def I would like to explain – hopefully comprehensible – how to support more or less arbitrary csv formats. Take just one of the existing files and adjust them accordingly!

  1. First one determines the order of the keys in the csv file.
  2. Then we define \STM@JK@DTLforeach ; a macro that reads the csv file line by line and outputs them as LaTeX table row. It uses to the \DTLforeach macro (datatool.sty)

    • As the first argument you pass the name of the csv file. No change!
    • The second argument maps the csv keys to macros
    • In the third and final argument, the output of the three-column table row is done
      • In the first column we output the posting and value dates
      • In the second column we output the reference, which may be composed of several csv keys.
      • In the third column we output the value. A negative amount will be typeset in red (negativcolor option)
      • Finally, a test on the last row of data is performed and the closing balance or a blank line is issued.
  3. In the last step, we define the separator of the csv file and determine whether it has a header row (Caution: header → noheader=false! (noheader option (datatool.sty))). The last line can be usually simply copied (siunitx setup)!

Hopefully this helps to adapt and support other csv formats! 😉

HowTo support other languages

#bankstatement #howto

Using the example of the new file stmnamibian.def I’d like to briefly explain how to support other languages. One recognizes immediately, that the filename must follow the pattern stmLANGUAGE.def. First, we consider the definition file for english:

If you want to support a namibian bank now, it requires of course the change of currency (3rd column) and the SEPA terms BIC and IBAN: