Discord is a popular chat app, much like Slack. In this tutorial, we’ll show you how to connect the Discord API to Google Sheets in 7 steps:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
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=your_client_id&scope=identify%20guilds.join&state=15773059ghq9183habn&redirect_uri=your_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.
Open up a command prompt window (for Windows OS) or a terminal (for Mac OS) and 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=your_redirect_URI" --data "scope=identify"
Note: For Mac OS you may need to use single quotes ( ' ) instead of double quotes ( " ).
Don’t forget to replace these values:
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.
Note: If the token/key that you generate has an expiration time, you will need to complete this same process again to get a new token when the old one expires.
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:
https://discordapp.com/api/v9/invites/{invite.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/v9/ base domain.
Discord API base/root URL:
https://discordapp.com/api/v9/
Note: Discord changes the version of their API often. Check their documentation to confirm the latest version and update the version number in the URL if necessary.
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:
https://discordapp.com/api/v9/users/@me
Headers: In the Headers section, add one row with the following key and value:
Key: Authorization Value: Bearer your_token
Replace your_token with the value of the token you generated previously, in Step 4. There should be a space between Bearer and your_token.
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.
Make a GET request
Make a POST request
PUT, PATCH, & DELETE Requests
Save requests for later
Schedule requests for automatic updates
Reference cell values in requests
=APIPHENY custom function
Stack multiple URLs in a single request
Run all saved requests at once
Modify your request settings
Import & export saved API settings
Ahrefs API
Airtable API
Alpha Vantage API
Asana API
Binance API
Clickup API
Coingecko API
Coinmarketcap API
Coinbase API
Constant Contact API
Discord API
Drift API
Etsy API
Eventbrite API
Facebook Graph API
Facebook Ads API
Figma API
Github API
Google SERP API
Hubspot API
Hunter API
What is an API?
What is an API URL?
What are parameters?
What is an endpoint?
What is an API key/token?
What is basic authentication?
What are headers?
What is a GET request?
What is a POST request?