Print

Import Movie Database (TMDb) Data to Google Sheets

In this guide, we’ll walk through how to pull movie and tv data from the community-driven site known as The Movie Database (TMDb) directly into Google Sheets, using the API Connector add-on for Sheets. We'll first get an API key from TMDb, and then set up a request to pull in movie data to your spreadsheet.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Get Your TMDb API Key

  1. If you haven't already, sign up for an account at https://www.themoviedb.org/account/signup
  2. While logged in, navigate to your account settings page and then click API. Alternately, you can click this link to go there directly: https://www.themoviedb.org/settings/api
    tmdb-img1
  3. Generate a new API key by clicking the link in the "Request a new API key" section:
    tmdb-img2
  4. You'll be prompted to select the appropriate type of API key for your project:
    tmdb-img3
  5. Read and accept the terms of use.
    tmdb-img4
  6. You will be asked to describe how you will use the API data you retrieve. While we aren't exactly making an app, fill out all required fields as best as possible and click Submit.
    tmdb-img5
  7. A new screen will appear showing your API keys. Congrats, you now have access to the TMDb API! Note that you can use either the API Key (v3 auth) or API Read Access Token (v4 auth) key for making requests to the API. However, since the v4 authentication method is newer and can be used across both API versions, this tutorial will use the v4 auth key.
    tmdb-img6

Part 2: Example: Get Top Rated Movies

We'll now pull TMDb API data into Sheets. For this example, we'll get a ranked list of the top rated movies on TMDb. Where it says your_token, substitute in your own API read access token.

  1. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  2. In the request form enter the following:
    • ApplicationCustom
    • MethodGET
    • Request URLhttps://api.themoviedb.org/3/movie/top_rated
    • Headers:
      • Authorization: Bearer your_token
      • Content-Type: application/json
  3. Create a new tab and click Set current to use that tab as your data destination.
  4. Name your request and click Run. A moment later you’ll see a list of top rated movies populate your Google Sheets.
    tmdb-response

Part 3: Example: Get Information About a TV Series

You can check the documentation for the full list of available API requests,  but here's an example of how to look up a TV series.

  1. First, navigate to https://www.themoviedb.org/ and find your show of interest. Note the numeric value in the URL; that's the tv_id and we'll need that to make our requests.
    tmdb-tvid
  2. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  3. In the request form enter the following. Where it says 70796, substitute in your own tv_id, and where it says 4 substitute in your own season of interest.
    • ApplicationCustom
    • MethodGET
    • Request URLhttps://api.themoviedb.org/3/tv/70796/season/4
    • Headers:
      • Authorization: Bearer your_token
      • Content-Type: application/json
  4. Create a new tab and click Set current to use that tab as your data destination.
  5. (optional) Under Output options, select Grid style. This makes the output a bit easier to read.
  6. Name your request and click Run. A moment later you’ll see information about the television series in your sheet.
    tmdb-tvresponse

Part 4: Handle Pagination

  1. The TMDb API limits the number of records returned in each request. By default, only the first page of records will be returned unless you use the 'page' parameter, and each page contains 20 records.
  2. With API Connector you can either run these paginated request URLs manually or loop through them automatically with pagination handling (paid feature), like this:
    • API URL: enter your regular request URL
    • Pagination type: page parameter
    • Page parameter: page
    • Number of pages: enter the number of pages you'd like to fetch
      pagination-page-parameter

Part 5: API Documentation

Official documentation: https://developers.themoviedb.org/4/getting-started

Leave a Comment

Jump To