I always wanted to use ledger to organize my finances. Unfortunately, for several years I only had banking statements in pdf format from my German “Postbank”. To import this data into ledger, I finally wrote a little Haskell parser to convert the pdfs into csv files.
The code can be found at maxdiefenbach/postbank2csv: Convert Postbank statements from PDF to CSV format.
It basically just uses pdftotext
to convert the pdf to txt and then parses the text with megaparse
into record types. Finally, the records are written in csv structure with cassava
.
My workflow continues with importing the csv into hledger
using csv import rules, that I try to describe in another post.