Connects Spotify + Google Apps Script + Twitter. Has functionality like converting a Spotify playlist to a Google Sheet and Tweeting every entry in it. Can set to run on a trigger if you want an update every hour or so.
- Output list of Spotify playlist(s) to a Google Sheet
- Output all Spotify playlists to their Google Sheets
- Tweet every entry in a playlist so when you add a song to a playlist, it shares on Twitter
- Add all songs from a rotating playlist (e.g. Discover Weekly & Release Radar) to a static playlist so you don't miss the recommended songs when they refresh
- Add all songs/features from an artist to their own playlist
- You can either import the scripts from this repo manually or use the plugin Google Apps Script GitHub Assistant to import: https://chrome.google.com/webstore/detail/google-apps-script-github/lfjcgcmkmjjlieihflfhjopckgpelofo
- Go to https://developer.spotify.com/dashboard/applications and sign in with your Spotify account.
- Create an app. Call it something simple like "Google Sheets Spotify Connector".
- Save your Client ID and Client Secret. Insert them above the
getSpotifyService_()
function in `spotify_oauth/getSpotifyService.gs. - Save the Redirect URI for your script. It is https://script.google.com/macros/d/<>/usercallback where <> is the script ID in the URL or in your script Project Settings. I saved it in
spotify_oauth/getSpotifyData.gs
for ease. - At https://developer.spotify.com/dashboard/applications, click on your app and Edit Settings. Add the Redirect URI created above. Save.
- Run one of the Spotify functions mentioned below or in
_primary/spotifyToGoogleSheets
. - On the first run through you'll see a URL generated in the Console Log: "Open the following URL and re-run the script: <>". Open the URL in a new tab.
- Agree to the Spotify app authorization request to authorize your script using OAuth.
- When you see "Success! You can close this tab.", go back to the script and re-run the function
spotifyToGoogleSheets()
in_primary/spotifyToGoogleSheets.gs
.
- Create a Twitter Developer account and create a new app: https://developer.twitter.com/en/portal/dashboard
- Save the keys and tokens from your new Twitter app in the
sendTweet()
function inhelpers/twitterFunctions.gs
. - If not already added, add the OAuth2 Library by the Script ID:
1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF
. Use the latest version. - If not already added, add the Twitter Library by the Script ID:
11dB74uW9VLpgvy1Ax3eBZ8J7as0ZrGtx4BPw7RKK-JQXyAJHBx98pY-7
. Use the latest version and name itTwitter
. - Enter the playlist IDs in
_primary/addSongsToPlaylistFromAnotherPlaylist
. - Change
var sheetName
in functionspotifyToGoogleSheets()
to whatever you want to be the name of the sheet. - Run
Tweet New Entries in a Playlist
from the Google Sheet orspotifyToGoogleSheets()
from Google Apps Script in_primary/spotifyToGoogleSheets
. Every entry in this playlist will be tweeted. The next time you run this function, it will compare the playlist with the entries in the sheet. If there are new entries (i.e. you added new songs to the playlist and it grabbed them), it will tweet them too. If you want to do this periodically and automatically, create a trigger to run this function about once an hour. Any more often and you might be rate limited by the API.
- Run
Print Playlists to a Google Sheet
from the Google Sheet orgetPlaylists()
from Google Apps Script inspotify_oauth/getPlaylists
. This will print your playlists to the "Playlists" sheet.
- Run
Get Content of All Playlists
from the Google Sheet orprintAllPlaylists()
from Google Apps Script in_primary/printAllPlaylists
. This will print all your playlist contents to the spreadsheet with each sheet being a different sheet. If you want to activate and move certain sheets to the front when the spreadsheet is open, updatevar faveSheets
for the functiononOpen()
in_primary/onOpen.gs
with the names of these sheets.
- Run
addSongsToPlaylistFromAnotherPlaylist()
from Google Apps Script. This will get the specified Spotify playlists, grab the songs, and add to a Google Sheet and another playlist. Helpful for adding tracks from weekly changing playlists (e.g. Discover Weekly, Release Radar) to a static one. - If you want to specify different playlists, update the variables in
_primary/addSongsToPlaylistFromAnotherPlaylist()
.
- Run
Add songs from an artist to a new playlist
from the Google Sheet. This will get the specified Spotify artist, grab the songs, add to a Google Sheet and then add to a new playlist. Helpful for checking out an artist's album songs, singles, and features. - Run
Add songs from an artist to My Current Playlist
from the Google Sheet. This will get the specified Spotify artist, grab the songs, add to a Google Sheet and then add to a specified playlist instead of a new one. - If you want to specify a different playlist, update the variables in
_primary/addToArtistPlaylist
.