This is a hackish code written in R for me to track personal credit card spendings and to track the spending category. I believe it might benefit others. It currently supports simple content extraction from bank PDFs,xlsx and CSV.
Currently it supports the following:
- DBS Credit Card statement (PDF) - I only tested on my range of Credit card so far
- UOB Credit Card xls
- Amex CSVs download
1. extract_dbs_pdf_cc_table
Call:
extract_dbs_pdf_cc_table('statement.pdf')
Returns: a DT
date | acct | item | amt |
---|---|---|---|
2020-08-22 | dbs | LAZADA SINGAPORE | 15.57 |
2020-08-23 | dbs | SHOPEEPAY | 110.00 |
2020-08-23 | dbs | SHOPEEPAY | 70.25 |
2020-08-24 | dbs | BLUESG | 47.19 |
2. extract_amex_csv_cc_table
Call:
extract_amex_csv_cc_table('amex.csv')
Returns: a DT
date | acct | item | amt |
---|---|---|---|
2020-08-20 | AMEX | GRAB*IOS-xxxx785-9-aaa SINGAPORE | 9.00 |
2020-08-21 | AMEX | GRAB*IOS-xxxx785-9-aaa SINGAPORE | 13.00 |
2020-08-22 | AMEX | GRAB*IOS-xxxx785-9-aaa SINGAPORE | 13.00 |
3. extract_uob_pdf_cc_table
Call:
extract_uob_pdf_cc_table('downloaded.xls')
Returns: a DT
date | acct | item | amt |
---|---|---|---|
2020-09-18 | UOB aaaa | NTUC FP-BT PANJANG PLZ SINGAPORE SG Ref No: 7450aaaaaaaaaaaaaaaaa61009467324190 | 25.48 |
4. tag_spending
Call:
tag_spending(df) #DF generated from above
Returns: a DT
Adds a TAG column for category
date | acct | item | amt | TAG |
---|---|---|---|---|
2020-09-18 | UOB aaaa | NTUC FP-BT PANJANG PLZ SINGAPORE SG Ref No: 7450aaaaaaaaaaaaaaaaa61009467324190 | 25.48 | RETAIL/GROCERY |
More examples of tags:
TAG | N |
---|---|
BILL | 4 |
TRANSPORT/BUSMRT | 40 |
FOOD/RESTAURANT | 23 |
Looking for people to:
- Enhance/'robustify' current functions
- Add new Singapore banks data format to this
- Expand Tagging dictionary
Eventually when the code gets more mature, i plan to make convert this into an R package