How to Download Robinhood Transaction History as a TSV

Posted on

I wanted to download a nicely formatted list of all my stock transactions (including dividends and cancelled transactions) but noticed there was no way doing that. I wrote up a little JavaScript code to quickly download the transaction list from Robinhood’s website.

Here’s how to do it yourself:

  1. go to https://robinhood.com/account/history using Chrome

  2. Scroll down to the bottom to where it says “Show more items” and click that button (so that all transactions are shown)

  3. Open the Chrome Dev Tools window (Windows - Ctrl + Shift + I, Mac - Option + Cmd + I)

  4. Paste this code into the console

    let csv = "Date\tType\tTotal\tTotal for Shares\tPrice per share\n";
    const sections = document.querySelectorAll('section');
    for (let i = 0; i < sections.length; i++) {
        const transactions = sections[i].querySelectorAll(':scope > div') // get direct children?
        for (let j = 0; j < transactions.length; j++) {
            const transaction = transactions[j].children[0].children[0];
            const date = transaction.children[0].innerText.split('\n')[1]
            const name = transaction.children[0].children[0].textContent
            const total = transaction.children[1].textContent.replace("+","");
            const pps = total.includes('shares') ? total.split(' shares at ')[0] : '';
            const numberOfShares = total.includes('shares') ? total.split(' shares at ')[1] : '';
            csv += `${date}\t${name}\t${total}\t${pps}\t${numberOfShares}\n`
        }
    }
    console.log(csv);
    
    function download(content, fileName, contentType) {
        var a = document.createElement("a");
        var file = new Blob([content], {
            type: contentType
        });
        a.href = URL.createObjectURL(file);
        a.download = fileName;
        a.click();
    }
    download(csv, 'transactions.tsv', 'text/plain');  
    
  5. Press ENTER

  6. Your TSV should now download!

  7. Then open in Google Sheets, Excel etc.

Concluding Thoughts

It was nice using my coding experience in the wild. Keep in mind, as a rule of thumb it’s not a good idea to copy and paste code into Dev Tools from strangers :) but I promise there is no shady code there.

Alternatively if you’re having trouble with the instructions, you can use https://robinhood.com/contact to ask Robinhood directly for a spreadsheet of your transactions and they will email one to you within a day or two.