As of this writing, the Discovery transactions export does not contain card numbers, so it’s impossible to get a breakdown of which virtual credit card spent how much money in any given month.
(I was having so much fun withduckdb importing the exported excel, about to join with the relevant timestamps, when I saw that the transaction times were often far apart. Alas.)
Also unfortunately, the emails only have base64-encoded HTML bodies, because somebody at Discovery just keeps on making bad decisions.
After much experimentation, I can give you this script which takes the email file as input and extracts the amount which appears right below the ***** Card payment *****
line:
I use the Emacs mu4e email client, so I can search for all Discovery emails for a given month and a given card number, and then apply the script above to all of the emails satisfying the search query:
This will yield a list of amounts, each on its own line.
If you don’t use mu4e
to read your email, you’ll have to find another mechanism to return the list of downloaded email files in question.
Now we can pipe all of that through some more awk
to get the total amount for that virtual card over the given month: