Skip to content

Instantly share code, notes, and snippets.

@lewdev
Created October 30, 2024 21:11
Show Gist options
  • Save lewdev/7f402e81c0f70bd0c7f057235ab8d9e2 to your computer and use it in GitHub Desktop.
Save lewdev/7f402e81c0f70bd0c7f057235ab8d9e2 to your computer and use it in GitHub Desktop.
๐ŸŽฎ Download CSV of Steam Purchases

๐ŸŽฎ Download CSV of Steam Purchases (473b)

Much like my script to Download Steam Library List, I created a similar script to download your list of Steam Purchases as a CSV file.

It's not perfect because you'll have to filter out the refunds and other types of transactions. Someone on reddit requested me to make it and I figured it was something I wanted to do myself so I did.

๐Ÿช Visit Purchase History Page

Your Purchase History

Then be sure to click on "Load More Transactions" at the bottom until it disappears so that you will capture your entire history. Then copy-paste the script into your console (hit F12 and "Console" tab).

a=document.createElement`a`;a.href=URL.createObjectURL(new Blob(["Date,Items,Type,Total,Wallet Change,Wallet Balance\n"+[...document.querySelectorAll('.wallet_history_table tr > td')].reduce((p,e,i)=>(p[i/6>>0]=(p[i/6>>0]||"")+'"'+e.innerHTML.trim().replace(/<\/?[^>]+(>|$)/g,"").replace(/\s+/g," ").replace(/"/g,'""').replaceAll(" Remove ","")+'"'+(i%6==5?"":","),p),[]).join`\n`],{type:"text/plain"}));a.click(a.download="steam-purchases.csv");URL.revokeObjectURL(a.href)

This script basically takes the HTML table an extracts the cell data and puts it all into a CSV format and downloads it.

It's not great because refunds and steam market sales are positive values so you'll have to manually delete them. I could possibly do that in the code but I don't want to spend more time on this.

If you're curious, my purchase total is $1,454.49 which includes purchasing the Steam Deck OLED for $678.

Let me know if you'd like a script to do this for any other pages!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment