Make your own Saregama Carvaan with YouTube and Google Sheets
Saregama Carvaan, a digital music player that looks like an old-fashioned transistor radio and targets the non-millennial generation, has become a huge hit in India. The company analysed data from online music streaming sites like Saavn, Gaana and YouTube, came up with a catalogue of 5000+ “greatest” Hindi movie songs and pre-loaded them into Carvaan, classified by artists and moods.
Like a radio station, Saregama Carvaan mixes nostalgia with an element of surprise - the player’s algorithm plays music in a random sequence so the listener would never know which song is coming up next. Can the Carvaan experience be recreated with YouTube? Let’s find out.
A quick Google search on the Saregama website led me to this PDF document - it contains a complete list of every song that’s bundled into the Carvaan player. I imported the songs PDF into a Google Spreadsheet so the data could be easily filtered by movie names or artistes.
The YouTube API lets you query the video database by keywords. I wrote a simple Google Script that reads the song titles from the Google Spreadsheet and finds the corresponding video on YouTube. The YouTube API returns the video link, the description, the channel of the video uploader and the thumbnail image (source code).
Google Spreadsheet provides the IMAGE formula that helped me embed the YouTube thumbnail URLs as images into the spreadsheet cells. I used Array Formulas to apply the same formula to the entire column in the spreadsheet.
The YouTube video IDs were converted to the YouTube URLs again with the help of a simple array formula.
Now the spreadsheet was populated with a list of songs that are preloaded into Carvaan and their corresponding YouTube videos.
The next task was to create a YouTube playlist with all the videos. I had earlier built a tool for copying YouTube playlists and the same API was used here for building the playlist inside the spreadsheet (source code).
And here’s the final result - a YouTube playlist with 5000 songs that come bundled with Carvaan. Press the “Shuffle” icon and the songs would play in random sequence continuously.
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.