Last active
December 24, 2019 01:20
-
-
Save emarref/a15d8bf4796ad9ab784832308679e476 to your computer and use it in GitHub Desktop.
Download ANZ credit card transactions into YNAB format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(() => { | |
const table = document.querySelector('.transactions-list'); | |
if (null === table) { | |
alert('Could not find transactions table'); | |
return; | |
} | |
const transactions = Array.from(table.querySelectorAll('.transaction-row')) | |
.filter(row => row.querySelector('.column-dr span') ? true : false) | |
.map(row => [ | |
new Date(row.querySelector('.column-trandate').innerText).toLocaleDateString(), | |
row.querySelector('.column-details span').innerText.replace('"', '""'), | |
row.querySelector('.column-dr span').innerText.substr(1) | |
]); | |
transactions.unshift(['Date', 'Payee', 'Outflow']); | |
const csv = transactions | |
.map(t => '"' + t.join('","') + '"') | |
.join("\n"); | |
const blob = new Blob([csv], {type: 'text/csv'}); | |
const url = window.URL.createObjectURL(blob); | |
const link = document.createElement('a'); | |
link.href = url; | |
link.download = 'transactions.csv'; | |
document.body.appendChild(link); | |
link.click(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment