Skip to content

Instantly share code, notes, and snippets.

@timiles
Last active March 8, 2016 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timiles/791623c9dd69052c873a to your computer and use it in GitHub Desktop.
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.)
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