Print

Import Twitch Data to Google Sheets

premium

In this guide, we’ll walk through how to import Twitch data directly into Google Sheets, using the API Connector add-on for Sheets. We'll set up a custom OAuth connection and connect to their API.

Contents

Before You Begin

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

Part 1: Get your Twitch OAuth Credentials

  1. Navigate to https://dev.twitch.tv/. You'll need to log in if you haven't already.
  2. In the top right, click Your Console
    twitch-yourconsole
  3. Click Register Your Applicationtwitch-register
  4. Fill out an app name and category, and include the OAuth redirect URL provided here. Click Create.
    twitch-create
  5. You'll see your new application. Click Manage
    twitch-manage
  6. The client ID and secret will be displayed on this page. Copy them and keep them handy, we'll need them shortly.
    twitch-credentials

Part 2: Connect Twitch to API Connector

  1. Open up Google Sheets and click Extensions > API Connector > Manage Connections
  2. Scroll to the bottom of the sidebar and click Add Custom OAuth
  3. Fill in the Custom OAuth modal as follows. If you like, edit the scopes you'd like to have access to.
    • OAuth Grant Type: Authorization Code
    • Name: Custom Twitch
    • Authorization Base URL: https://id.twitch.tv/oauth2/authorize?scope=user:edit user:read:email user:read:follows
    • Token URL: https://id.twitch.tv/oauth2/token
    • Client IDprovided by Twitch
    • Client Secretprovided by Twitch
  4. Click Save
    twitch-customoauth
  5. Click Manage Connections to return to the list of connections
  6. Scroll down until you find your new custom connection. Click Connect
    twitch-connect
  7. You'll be prompted to give access to the new app you created above. Click Authorize
    twitch-authorize
  8. You'll be returned to your sheet and can verify that the new connection is now active.

Part 3: Get Twitch Data in Sheets

To create a request, include your full request URL in the request URL field, and select your custom Twitch connection from the dropdown OAuth menu.

You can see the full list of available endpoint and parameters in the API documentation. For example, here we'll get information about a specific channel. Substitute in your own client ID where it says your_client_id.

  • Application: Custom
  • Method: GET
  • Request URL: https://api.twitch.tv/helix/channels?broadcaster_id=141981764
  • OAuth: Custom Twitch
  • Headers
    • Client-Id: your_client_id
twitch-response

Part 4: API Documentation

Official API documentation: https://dev.twitch.tv/docs/api/reference/

13 thoughts on “Import Twitch Data to Google Sheets”

      • i made some progress with it now thank you for responding i also have one more question. I ran the api connector but i got this error message:
        Completed with errors
        - We received an error from twitch.tv (400) show response
        {"error":"Bad Request","status":400,"message":"Missing required parameter \"broadcaster_id\""}

        where would i find the broadcaster_id ?

    • Add them to the end of the request URL with a separate "login" parameter for each one, e.g. ?login=X&login=Y&login=Z, where X, Y, and Z are the names are the streamers you're interested in.

      Reply
    • You can add it to the end, e.g. https://api.twitch.tv/helix/channels/followers?broadcaster_id=44445592
      To make it more automated, you can list all your broadcaster IDs in one column and then reference them in your request, e.g. https://api.twitch.tv/helix/channels/followers?broadcaster_id=+++Sheet1!A1:A10+++

      Reply
  1. Hello i was able to pull a list of users for my analysis but when i make the request i only get the total number. and a empty column next to it. How do i identify the broadcaster to the number of followers in the query ?

    Reply
    • Tick the "Add request URL" box (under Output options) to see the request URL you sent initially alongside the response from the API.

      Reply
      • Thank you. That worked now i ran into a issue if i wanted to create a list i tried the syntax https://api.twitch.tv/helix/channels/followers?broadcaster_id=42413421&broadcaster_id=57292858 and i only got one line. How do i populate a list of users ?

      • Twitch only lets you enter a single broadcaster_id at a time. However you can cycle through a list of broadcaster IDs, running a request for each one, in a multi-query request like https://api.twitch.tv/helix/channels/followers?broadcaster_id=+++Sheet1!A1:A10+++

Leave a Comment

Jump To