Created
March 27, 2024 19:27
-
-
Save alecbw/a14fab00e58be94c7540905fcb4283df to your computer and use it in GitHub Desktop.
A snippet you can paste in the console after manually paginating through as many months of transaction data as you like to cleanly export it to CSV. The only alternative Wealthfront provides natively is per-month PDFs. Based heavily on Mike Bianco's work - mikebian.co/download-a-csv-of-wealthfront-financial-activity
This file contains hidden or 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
rows = document.querySelectorAll('.tk-list-item-wrapper'); | |
csvData = []; | |
rows.forEach(row => { | |
texts = Array.from(row.querySelectorAll('[data-toolkit-component="Text"]')) | |
.map(element => { | |
let text = element.textContent.trim(); | |
// Check if text matches "completed DD/MM/YYYY" and extract the date | |
let match = text.match(/completed (\d{2}\/\d{2}\/\d{4})/); | |
return match ? `"${match[1]}"` : `"${text}"`; // Add quotes for CSV format | |
}); | |
csvData.push(texts.join(',')); | |
}); | |
csvString = csvData.join('\n'); | |
blob = new Blob([csvString], {type: 'text/csv'}); | |
// create a button we can click to download the CSV | |
downloadUrl = URL.createObjectURL(blob); | |
downloadLink = document.createElement('a'); | |
downloadLink.href = downloadUrl; | |
downloadLink.download = 'data.csv'; | |
document.body.appendChild(downloadLink); | |
downloadLink.click(); | |
document.body.removeChild(downloadLink); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment