Exporting playlists from Google Play Music to Spotify

Spotify is so much better than Google Play Music! Whether it’s in the field of cool features (like using your smartphone to control the music on your computer) or just basic user experience (like ability to filter songs inside a playlist) – Spotify wins by far!

There’s just one thing that for the past two months was stopping me from migrating to Spotify. Neither in Spotify nor in GPM can you export or import a list of songs. Really! And I really don’t have time to search for all my songs again...

Fortunately, there’s Soundiiz! This fancy tool allows you to migrate playlists between different streaming services. Among which... there’s no GPM, because of course there isn’t. Oh, damn you, Google!

We can however upload a text file (in format Artist - Title for each line) to Soundiiz and it will automatically find our songs in the Spotify database, creating a playlist. Cool! So now we only have to create such file.

We might just scrape the data from GPM’s HTML, couldn’t we? Well, Google doesn’t make it easy. It loads the list of songs dynamically while you’re scrolling... Oh, damn you, Google!

Anyways, my solution is:

  1. Open GPM, chose the playlist in that you’d like to export.
  2. Open the JavaScript console (in Chrome it’s Ctrl+Alt+J, in Firefox Ctrl+Alt+K).
  3. Paste the following code:
var fetched = [];
function fetch() {
    var playlist = document.querySelectorAll('.song-table tr.song-row');
    for(var i = 0; i < playlist.length; i++) {
        var title = playlist[i].querySelectorAll('td[data-col="title"] .column-content')[0].textContent;
        var artist = playlist[i].querySelectorAll('td[data-col="artist"] .column-content')[0].textContent;
        var row = artist + ' - ' + title;
        if (fetched.indexOf(row) == -1) {
            fetched.push(row);
        }
    }
    console.log(fetched.length);
}
var interval = setInterval(fetch, 100);
function done() {
    clearInterval(interval);
    console.log(fetched.join("\n"));
}
  1. Scroll down through your playlist. You should see growing numbers appearing in the console. When you’re done scrolling, this number should be equal to the number of songs in the playlist.
  2. Type done(); and you should see the list of your songs.
  3. Now just copy-paste it to a file and save it.
  4. Go to Soundiiz and connect with your Spotify account.
  5. Upload the file.
  6. Relax ;-)
A photo of me

About the author

Hi! I'm Andrea (they/them). I tell computers what to do, both for a living and for fun, I'm also into blogging, writing and photography. I'm trying to make the world just a little bit better: more inclusive, more rational and more just.