Note · June 20, 2026

Export Spotify track data to a CSV in Python (no API key)

Turn a column of Spotify links into a clean spreadsheet — name, artists, preview — with the standard csv module and no OAuth. Or dump the whole record to JSON.

Sometimes you don’t want an integration — you want a spreadsheet. A column of Spotify links goes in; a tidy CSV comes out. Here it is with nothing but the standard library and SpotifyScraper.

import csv
from spotify_scraper import SpotifyClient

urls = [
    "https://open.spotify.com/track/0VjIjW4GlUZAMYd2vXMi3b",
    "https://open.spotify.com/track/7ouMYWpwJ422jRcDASZB7P",
]

with SpotifyClient() as client, open("tracks.csv", "w", newline="") as f:
    writer = csv.writer(f)
    writer.writerow(["name", "artists", "preview_url"])
    for url in urls:
        track = client.get_track(url)
        artists = ", ".join(a.name for a in track.artists)
        writer.writerow([track.name, artists, track.preview_url])

That’s the whole thing. track.artists is a list, so joining the names keeps multi-artist tracks honest in a single column.

When you want every field

to_dict() hands you everything the page exposed, JSON-safe — so if a CSV is too flat, dump the full record instead and pick fields later:

import json

with SpotifyClient() as client:
    track = client.get_track(url)
    print(json.dumps(track.to_dict(), indent=2))

That’s also the easiest way to discover what’s available: print one record, see the shape, then write the columns you actually want.

Beyond single tracks

The same client reads albums, artists, and playlists the same way — client.get_album(url), client.get_playlist(url) — each handing back the same kind of typed object. So the pattern scales from one track to a whole release without changing the idea: resolve, read the fields you care about, write the row.

The honest part

Everything here is the public metadata the web player already renders — fine for datasets, research, and tools. It’s data and previews, not full songs (those are DRM-protected). The library is an unofficial reader of public data, not affiliated with Spotify.

Try it in the browser first, then pip install spotifyscraper or read the source on GitHub.

boiler room — ali@aliakhtari.com