In order to do this, your Android device must be rooted, otherwise you won't have access to the music database file where the playlists are stored.
If you don't have an Android device, there's a chance you could use the android emulator from the Android SDK. You'd have to find an .apk file for the Google Play Music app, which shouldn't be too hard.
- First, make sure all of your tracks and playlists are synced with Google's servers:
- Install the Google Play Music app on the Android device. If it's already installed, open up the Google Play Store app, go to Menu --> My apps, and if it's in the list of updates, update it.
- Connect your Android device to the internet (data or wifi)
- Open the Google Play Music app
- This step will probably change as Google continues to update the app, but essentially you want it to show all of your music in the cloud and refresh it. The current way to do this is:
At the top left of the app, make sure it says All music. If it says On device, tap it and change it to All music. Click Menu --> Refresh - Wait for all of the tracks and playlists to sync (you should be able to see all of your playlists and music in the app)
- Exit the Google Play Music app by pressing the back button
- Next, you need to get the music database file from the Android device. The file is located at /data/data/com.google.android.music/databases/music.db. There are several ways to do this:
- You can use a file manager app, browse to the file, copy it to your SD card, then plug the phone into your computer and copy it from there. Whichever file manager app you use, it needs root access. I'm currently using File Explorer by NextApp with the Root Add-On.
- Using a file manager app, browse to the file and send it to yourself using whatever method is easiest for you (email, Dropbox, etc.).
- As an Android developer, because I already have the Android SDK installed, my preferred method is to transfer the file using the Android SDK Platform Tools over the command line.
- Open the music.db file with your favorite SQLite database client (I prefer Sqliteman) to get the playlist data, using this query:
select name as "Playlist Name", artist, title from listitems join music on listitems.musicid = music.id join lists on listitems.listid = lists.id order by "Playlist Name";
From there you can export the data to a friendly format, such as a CSV file. To do a quick dump of the data from a Linux/Mac terminal, you can run this command:
sqlite3 music.db 'select name as "Playlist Name", artist, title from listitems join music on listitems.musicid = music.id join lists on listitems.listid = lists.id order by "Playlist Name"' > playlists.txt
There are a lot of other columns available, such as album. to get the full list, just replace everything in the query from select to from with *, i.e.
select * from listitems...
Enjoy!