To pull data from the Discord 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 Discord 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 Google Sheet and then click on the Add-Ons option in the top menu. In the add-ons menu, you should see Apipheny. Just click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets.
Go to https://discord.com/developers/applications and click the New Application button:
In the Create an application popup, complete the Name field and then click the Create button:
Your app will then be created and the client id and secret will be displayed on the screen:
Click the Copy button and then paste these values to a safe location, because you will need the ID and client secret in the following steps.
In the OAuth2 section, add a redirect URI by clicking the Add Redirect button:
Complete the Redirects field with any valid URL and then save the changes by clicking the Save Changes button:
Go to the following link into your browser: https://discordapp.com/api/oauth2/authorize?response_type=code&client_id=&scope=identify%20guilds.join&state=15773059ghq9183habn&redirect_uri=&prompt=consent
Don’t forget to replace your_client_id and your_redirect_uri values with the ones you obtained in Step 2 above.
Then you’ll be asked to authorize the action. Click the Authorize button:
You’ll then be redirected to your redirect URL. At the end of the URL, you’ll find the required code:
Copy the value after the “code“ parameter to a safe location, because you’ll need it later.
In your console window, enter the following command:
curl -X POST "https://discordapp.com/api/oauth2/token" --data "client_id=<your_client_id>" --data "client_secret=<your_client_secret> " --data "grant_type=authorization_code" --data "code=<your_code>" --data "redirect_uri=<redirect_URI> " --data "scope=identify"
Don’t forget to replace these values:
<your_code> is the code you previously obtained in Step 3.
<your_client_id> is your client id from Step 2.
<your_client_secret> is your client secret from Step 2.
<redirect_URI> is your redirect URI from Step 2.
For the scope parameter, you should add any scopes that your requests need, separated by commas.
Your Bearer access token will then be displayed in the response:
Copy and paste your Bearer access token to a safe location because you’ll need it later.
In this section, we’ll show you how to browse the Discord API documentation to find an API endpoint URL that retrieves the information you need. If you already know your endpoint URL, or you want to use the same example URL as us, just skip to Step 6.
First, open the Discord API documentation page: https://discord.com/developers/docs/reference
The menu on the left contains a list of categorized endpoints for the Discord API:
In this case, we’ll use the Invite category, which contains two endpoints: Get invite and Delete invite.
An example endpoint is the Get invite endpoint, which returns an invite object for the given code:
The documentation for this endpoint contains the HTTP method used (GET) and the request path, a short description of the endpoint’s purpose and a table describing the accepted parameters:
All API calls to Discord should be made to the https://discordapp.com/api/v6/ base domain.
Discord API base/root URL:
Now 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 sidebar, 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 5, we explained how you can find the Discord 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 Get current user endpoint that returns the current user. The corresponding URL is:
Headers: In the Headers section, add one row with the following key and value:
Key: Authorization Value: Bearer <your_token>
Where <your_token> value is the token you generated previously, in Step 4. There should be a space between Bearer and <your_token>. Do not include the carrots “<>”.
Lastly, click the Run button at the bottom of the Apipheny add-on and then wait for the Discord API data to be pulled in to your Google Sheet:
After making a successful request to the Discord API, try querying a different endpoint, or try using one of the more advanced features in the Apipheny add-on.
If you want to integrate your Discord API with Google Data Studio, just follow the same steps above and then connect your Google Sheet to your Google Data Studio report.