I'm wondering if anyone has found a way to download one's entire iTunes or App Store purchase history as a CSV file?
I know that from within iTunes I can go to Account / View Account / Purchase History, but this has numerous problems. It does not let me download the results, but only shows them in iTunes. It does not show all purchases, but instead shows results one screenful at a time. And it does not even show purchases as individal line items, but shows them grouped into collections you need to click into. It's almost like they're trying to make it hard to see how you spend on the App Store or iTunes Store….
I have not been assiduously saving all the email receipts regarding my purchases, so I cannot access this information by doing bulk processing of those old emails.
So is there any other way to get access to this information except for the inadequate iTunes interface?
And if the only way is via the iTunes interface, is there any way to script the UI so I could write a program that iterated through all results and extracted them? Has anyone actually succeeded in doing this?
Best Answer
You asked, "is there any way to script the UI?" Yes, if you are on a Mac. You also asked, "Has anyone actually succeeded in doing this?" Sort of. My history goes back to 2005, and the iTunes Store session kept timing out, so I had to run it it batches, but the following script does work. Be aware that it runs very slowly; simply retrieving the class of an object from iTunes can take almost a second. I would welcome any performance enhancements anyone can suggest.
This worked on OS X Yosemite 10.10.5 with iTunes 12.3.2.35, and on OS X Mavericks 10.9.5 with iTunes 12.3.2.35, on or around February 28th, 2016. Any changes Apple makes to the iTunes Store account interface will likely break this script.
In iTunes, go to Store > View Account, log in, scroll to Purchase History and click See All, then, when the screen showing Batch 1 out of N is visible, run the following script in Script Editor:
This produces tab-delimited text, not CSV as the OP requested, but most spreadsheet applications will import it. Gift purchases seem to mess up the formatting, so it may need some manual curation.
I relied on information at http://n8henrie.com/2013/03/a-strategy-for-ui-scripting-in-applescript/ to learn how to do GUI scripting.