API Connector Documentation
Import Twitch Data to Google Sheets
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
- Part 1: Get Your Twitch OAuth Credentials
- Part 2: Connect the Twitch API to API Connector
- Part 3: Get Twitch Data in Sheets
- Part 4: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get your Twitch OAuth Credentials
- Navigate to https://dev.twitch.tv/. You'll need to log in if you haven't already.
- In the top right, click Your Console
- Click Register Your Application
- Fill out an app name and category, and include the OAuth redirect URL provided here. Click Create.
- You'll see your new application. Click Manage
- The client ID and secret will be displayed on this page. Copy them and keep them handy, we'll need them shortly.
Part 2: Connect Twitch to API Connector
- Open up Google Sheets and click Extensions > API Connector > Manage Connections
- Scroll to the bottom of the sidebar and click Add Custom OAuth
- 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 ID: provided by Twitch
- Client Secret: provided by Twitch
- OAuth Grant Type:
- Click Save
- Click Manage Connections to return to the list of connections
- Scroll down until you find your new custom connection. Click Connect
- You'll be prompted to give access to the new app you created above. Click Authorize
- 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
Part 4: API Documentation
Official API documentation: https://dev.twitch.tv/docs/api/reference/
i cant get my token url i need more details on this please help
The token URL should be
https://id.twitch.tv/oauth2/token
, is that what you're looking for?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 ?
You can get the broadcaster_id with the Get Users endpoint, e.g
https://api.twitch.tv/helix/users?login=pokimane&login=xQc
. The broadcast ID will be returned in the field calleddata.id
Also what if i have a specific list of streamers that i want to pull data on?
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.Thanks so much ill try this out!
Heres another update it worked! i have another question if i want to pull find the follower count for each user in my list i was thinking of using this end point https://api.twitch.tv/helix/channels/followers but when i try that it tell me that i need a broadcaster id. i have my broadcaster id now so where would i put that parameter?
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+++
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 ?
Tick the "Add request URL" box (under Output options) to see the request URL you sent initially alongside the response from the API.
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+++