To pull data from the Reddit API to Google Sheets easily and without writing any code, first install and open the Apipheny Google Sheets add-on.
Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs (including the Reddit API), save API requests, schedule API requests, and more. Click here if you want to learn more about Apipheny.
1. Install Apipheny by clicking the Install button on this page.
2. After you’ve installed Apipheny, open a new or existing Google Sheet and then click on Add-Ons in the menu at the top of your Google Sheets. If you’ve installed Apipheny, you’ll see it as an option in the dropdown menu. Just click Apipheny > Import API to open the Apipheny sidebar in your Google Sheet.
This step is necessary to call the Reddit API. First make sure you’re logged in to your reddit account.
Then, to create a Reddit API App, first go to https://www.reddit.com/prefs/apps/ and click the “are you a developer? create an app” button:
Then complete the steps:
Once you have all the fields filled in, click the create app button:
You can use any valid link as the redirect URL, including https://apipheny.io/.
After you click “create app”, your app will be created:
On this dashboard page of your new app, you will find the app ID and secret. Copy and paste these values to a safe location because you’ll need them in the upcoming steps.
Note: the “app ID” is the value under “personal use script” in the screenshot above.
In your console window, write the command below to obtain your Reddit API token:
curl -A -X -d "grant_type=password&username=YOUR_USERNAME&password=YOUR_PASSWORD" --user "APP_ID:APP_SECRET" https://www.reddit.com/api/v1/access_token
You’ll need to fill in a few parts of the code with your own values:
Executing this command will return your Reddit API access token in the response. Copy your access token and paste it somewhere safe as you will need it in the next steps.
Every API has an endpoint. The endpoint is the latter part of the API URL that tells the API what specific data you’re looking for.
In this section, I’ll show you how to browse the Reddit API documentation to find an API endpoint URL that retrieves the information you need from Reddit. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 5.
To browse the reddit API docs, first open the Reddit API documentation page by going to the following link: https://www.reddit.com/dev/api
The menu on the left of the page contains a list of methods/endpoints for the Reddit API:
An example method/endpoint is /api/v1/collections/subreddit_collections, used to fetch collections for a subreddit. This is the whole URL for that endpoint:
The documentation for this endpoint contains the endpoint’s HTTP method (GET) and path, a short description of the endpoint’s purpose, and the accepted parameters:
All API calls to Reddit should be made using the https://oauth.reddit.com/api/v1/ base domain. All endpoints and parameters would be appended to this endpoint.
Reddit API base domain/root URL: https://oauth.reddit.com/api/v1/
We’re in the final stretch. Go back to your Google Sheet and make sure that the Apipheny add-on is open on the “Import” tab. With the Import Tab open, enter these details into the add-on:
Method: At the top of the Apipheny add-on, select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using the GET method.
API URL: In Step 4, we explained how you can find the Reddit API endpoint that you need. Now copy the complete URL into the Apipheny add-on, where it says API URL Path (JSON / CSV), followed by any GET parameters required for your query.
For this example, we are using the team.info method, that gets information about the current team. The corresponding URL for this API is:
In the Headers section, add one row with the following key and value:
<your_token> is the value of the token you obtained previously, in Step 3. There should be a literal space between Bearer and <your_token>. Do not include the carrots “<>” around your token.
Here’s what our Reddit API request looks like in Apipheny:
Finally, click the Run button at the bottom of the Apipheny add-on and then the data your requesting from Reddit will be pulled into your Google Sheet, like so:
After making a successful request to the Reddit API, try querying a different Reddit endpoint (method), or try using one of the more advanced features in the Apipheny add-on, such as:
If you want to pull Reddit data into Google Data Studio, just follow the same steps above and then connect your Google Sheet with your Google Data Studio report.