If you need to import data from Slack into Google Sheets, you can do so using the Slack API and the Google Sheets API.
In this tutorial, I’ll show you how to connect the Slack API to Google Sheets in 5 steps:
Apipheny is a free API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to API data sources, easily.
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
First, go to https://api.slack.com/ and click on the Your Apps button:
In the Your Apps page, click the Create an App button:
In the Create a Slack App popup, complete the App Name field, choose a Development Slack Workspace and then click the Create App button:
Next your will be directed to the Basic Information page of your newly created Slack app:
On this page, scroll down and click the Permissions button to configure permissions to allow your app to interact with the Slack API:
Next you will be directed to the OAuth&Permissions page, where you’ll find the Bot User OAuth Access Token, necessary for making API requests:
Copy and paste your Bot User OAuth Access Token to a safe location, because you’ll need it in the upcoming steps.
Next, on the same page, scroll down to the Scopes section and click the Add an OAuth Scope button to add the scopes required to be able to access the Slack API endpoints you need:
On the next page, choose the scopes you need from the drop-down list. This is what determines what data you’ll be able to pull from the Slack API into your Google Sheet:
After you choose your scopes, you’ll be asked to reinstall your app.
Click the reinstall your app link to begin the installation:
Then, choose a channel for your app from the drop-down list and then click the Allow button:
In this section, we’ll show you how to browse the Slack API documentation to find an API URL that retrieves the information you need from your Slack account.
Every API URL has an endpoint. An endpoint is the latter part of the API URL that tells the API what data you’re specifically looking for.
If you already know your endpoint/URL, or you want to use the same example URL as us, just skip to Step 4.
To browse the Slack API endpoints, first open the Slack API documentation page: https://api.slack.com/apis
On that page, you’ll see that the menu on the left of the page contains a list of guides and references for the available APIs:
In the Reference section, click on Methods to access the API Methods page:
“Methods” is the term Slack uses for its endpoints, but a method and endpoint are the same thing.
An example Slack method/endpoint you can retrieve data from is team.info. The whole API URL including this endpoint would look like this:
https://slack.com/api/team.info
The documentation for this endpoint and other endpoints contains a short description of the endpoint’s purpose, the method’s full URL, the preferred HTTP method used (eg. GET), the accepted content type, the rate limiting tier and a table containing the required scopes for each supported token type:
All API calls to the Slack API should be made to the https://slack.com/api/ base domain. This is the first part of the URL that all endpoints would be appended to.
Slack API base URL/root domain: https://slack.com/api/
Now, to import Slack data into your Google Sheet, go back to your Google Sheet and make sure that the Apipheny add-on is open with the “Import” tab open. Enter these details into the Import Tab of Apipheny:
Method: At the top of the Apipheny add-on, select the HTTP method (GET or POST) as required by your API endpoint. For this example, we are using the GET method. If you’re importing data into Google Sheets, your endpoint is most likely using the GET method.
API URL: In Step 3, we explained how you can find the Slack API endpoint that you need to import the specific data that you want. Now copy the complete URL (base URL + endpoint) 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, which gets information about the current team.
The full URL for this endpoint is:
https://slack.com/api/team.info?token=access_token
If your Slack API URL requires an access token, it’s the bot token that you generated previously in Step 2. Just replace access_token with your bot token.
In the Headers section of the add-on, add one row with the following key and value:
Headers Key: Content-Type Value: application/x-www-form-urlencoded
Lastly, to import your Slack API data into your Google Spreadsheet, click the Run button at the bottom of the Apipheny add-on and then wait for the Slack API data to be pulled into your Google Sheet:
And that’s how you can integrate Slack with Google Sheets using the Apipheny add-on!
After making a successful API request to the Slack API in your Google Sheet, try querying a different Slack API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Schedule requests for automatic updates
Reference cell values in requests
Stack multiple URLs in a single request
Crypto API Tutorials: