Search API Connector Documentation
Import Spotify Ads Data to Google Sheets
In this guide, we’ll walk through how to pull Spotify Ads data directly into Google Sheets, using the API Connector add-on for Sheets.
- Before You Begin
- Part 1: Get OAuth Credentials
- Part 2: Set up Custom OAuth Connection
- Part 3: Pull Spotify Ad Data into Sheets
- Part 4: Flatten Fields to Headers
- Part 5: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get OAuth Credentials
Spotify Ads uses OAuth, which means we need to set up an “app” through their developers console.
- While logged into Spotify, navigate to https://developer.spotify.com/dashboard/applications and click Create An App
- You’ll be prompted to give your app a name and description. Click Create
- You’ll now be in the main apps dashboard. Click Edit Settings.
- Under Redirect URLs, enter
- Scroll down and click Save.
- On the left you’ll see your client ID and secret, copy those down as we’ll need them in a moment.
Part 2: Set up Custom OAuth Connection
- Back in Google Sheets, navigate to Extensions > API Connector > Manage Connections
- Scroll down to the Custom Connections section and click Add Custom OAuth
- In the Custom OAuth Manager, enter and save the following:
- Name: Spotify Ads
- Authorization Base URL: https://accounts.spotify.com/authorize?scope=streaming
- Token URL: https://accounts.spotify.com/api/token
- Client ID: enter the value from the developer console
- Client Secret: enter the value from the developer console
- Click Manage Connections to return to the Connections screen. Scroll down and you should see your new connection listed. Click Connect
- You’ll be prompted to approve the connection. Click Agree
- You’ll be redirected into your Google Sheet and can verify that the connection is now active.
Part 3: Pull Spotify Ad Data into Sheets
We’re now ready to fetch some data from the Spotify Ads API into Google Sheets. Open up Google Sheets and click Extensions > API Connector > Open > Create Request, and enter the following:
- Method: POST
- Request URL:
- OAuth: Spotify Ads
- Headers: Key = Content-Type, Value = application/json, Key = Accept, Value = application/json
- Request body:
For more available metrics and breakdowns, please check the documentation.
Part 4: Flatten Fields to Headers
By default, Spotify’s API sends back data where field headers are in one column and field values are in the next. To convert those field headers into column titles, you can flatten fields to headers, like this:
- path to header: page.rows.fields.type
- path to value: page.rows.fields.value
While you’re at it, select “Truncate headers” to clean up the titles even further. The end result should look like this:
Part 5: API Documentation
Official API documentation: https://developer.spotify.com/documentation/ads-api/reference/#/operations/get_report