Last active
March 8, 2016 21:18
-
-
Save timiles/791623c9dd69052c873a to your computer and use it in GitHub Desktop.
Download Barclays bank transactions from logged in view, as csv file. (Export feature does not include balance info.)
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
String.prototype.cleanMoney = function() { | |
return this.replace('-', '').replace('£', '').replace(',', ''); | |
} | |
var csv = ''; | |
var trs = $('#filterable-ftb tr'); | |
for (var index = 1; index < trs.length; index++) { | |
var tr = trs[index]; | |
var col0 = $('td[headers=header-date]', tr).text().trim(); | |
var col1 = $('td[headers=header-description] span', tr).text().trim(); | |
var col2 = $('td[headers=header-money-out]', tr).text().trim().cleanMoney(); | |
var col3 = $('td[headers=header-money-in]', tr).text().trim().cleanMoney(); | |
var col4 = $('td[headers=header-balance]', tr).text().trim().cleanMoney(); | |
csv += col0 + ',' + col1 + ',' + col2 + ',' + col3 + ',' + col4 + '\r\n'; | |
} | |
var a = document.createElement('a'); | |
a.download = 'transactions.csv'; | |
a.type = 'text/csv'; | |
a.href = URL.createObjectURL(new Blob([csv])); | |
a.click(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment