Skip to content

Instantly share code, notes, and snippets.

@alecbw
Created March 27, 2024 19:27
Show Gist options
  • Save alecbw/a14fab00e58be94c7540905fcb4283df to your computer and use it in GitHub Desktop.
Save alecbw/a14fab00e58be94c7540905fcb4283df to your computer and use it in GitHub Desktop.

Revisions

  1. alecbw created this gist Mar 27, 2024.
    25 changes: 25 additions & 0 deletions Export_Wealthfront_Transactions_to_CSV.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    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);