Search API Connector Documentation
Import Spotify Data to Google Sheets
In this guide, we’ll walk through how to pull Spotify music data directly into Google Sheets, using the API Connector add-on for Sheets.
Contents
- Before You Begin
- Part 1: Connect to the Spotify API
- Part 2: Pull Data from Spotify to Sheets
- Part 3: Create a Custom API Request
- Part 4: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Connect to the Spotify API
The easiest way to get started with the Spotify API is through API Connector’s built-in integration.
- Select Spotify from the drop-down list of applications
- Under Authorization, click Connect to Spotify
- You will be directed to spotify.com and asked to authorize the connection. Click Agree.
- You'll then be returned to your Google Sheet, and can verify that your Spotify connection is active.
Part 2: Pull Data from Spotify to Sheets
Now that we’re connected, let’s pull some data into Sheets.
- Under Endpoint, choose
/search
to search Spotify's catalog of music. - Fill out the required
q
andtype
parameters to indicate your search query and the type of resource to search. - Select a destination sheet, name your request, and click Run.
Part 3: Create a Custom API Request
Alternatively, you can create a custom request instead of using API Connector’s built-in integration, using any of the endpoints and parameters shown in the API documentation. For example:
- Application:
Custom
- Method:
GET
- Request URL:
https://api.spotify.com/v1/me
- OAuth:
Spotify
Part 4: API Documentation
To see more API endpoints and example responses, check out the Spotify Web API reference located at https://developer.spotify.com/documentation/web-api/reference
To view/disconnect API Connector on Spotify's side, navigate to https://www.spotify.com/us/account/apps/.
Can I get the entire music library this way? I want to compare which songs I have offline the same as ones present in Spotify and delete only them and probably add the rest as a separate playlist.
You should be able to get all the music in your own library this way, I don't think you could get all the music in Spotify's library though (Sheets would run out of space before you got there!).
Oh. ok. Thanks for the reply. Do you know whether there is an online Spotify catalogue which is viewable?
I only see this: https://explore.spotify.com/us/pages/mobile-feature-discover-catalog
I think you can import your music library by selecting the "Get User's Saved Tracks" endpoint from the "Library" menu in the Console tab.
This is the the endpoint: https://api.spotify.com/v1/me/tracks.
This should work I believe.
Thanks Matt!
awesome
Will i be able to import data regarding streams to my sheet, to get frequently updated data on my own portfolio (music producer)?
As far as I know, Spotify's API doesn't provide stream count numbers. There are quite a few comments/complaints about it on their forum, e.g. here. Based on that thread, it seems some third party tools have found a way to offer this, maybe by scraping Spotify's interface (where it seems like this data is provided). So maybe you can try using an unofficial API for Spotify instead.
When trying to pull an artist's top tracks, I am getting an error saying "missing country parameter". However I don't see a place to enter the country id?
Thanks for letting me know! I just added a country selector to that endpoint so you should be able to select it now.