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:

  1. Install the Apipheny Google Sheets API Add-on
  2. Create a Slack API App & Obtain a Slack Bot Token
  3. Choose your Slack API Endpoint
  4. Enter Slack API Request into Apipheny
  5. Call the Slack API in your Google Sheet

Step 1.) Install and open the Apipheny Add-on in Google Sheets

To pull data from the Slack API to Google Sheets easily and without any coding, first install and open the Apipheny Google Sheets add-on.

Apipheny is a no-code Google Sheets API add-on that you can use to make unlimited API requests, connect to unlimited API data sources, save your API requests, schedule API requests to refresh data on a scheduled basis, and more. Click here for more info about Apipheny. There’s a 30-day free trial included, then it’s $19-$29/month.

1. Install Apipheny by opening the following link in on desktop and then clicking the Install button on the page: https://gsuite.google.com/marketplace/app/apipheny/966163326746

Install Apipheny to connect the Slack API
Install Apipheny to connect the Slack API

2. After you’ve installed Apipheny, open a Google Sheet and then click on the “Add-Ons” option in the top navigation menu. In the Add-ons menu, you should see Apipheny if you installed it already. If you didn’t install it yet, you can click “Get add-ons” and search for Apipheny.

After installing Apipheny, in the nav menu, click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets.

Open Apipheny to make your Slack API request
Open Apipheny to make your Slack API request

Step 2.) Create a Slack API app and get your Slack Bot Token

First, go to https://api.slack.com/ and click on the Your Apps button:

Slack API Developer Portal
Slack API Developer Portal

In the Your Apps page, click the Create an App button:

Click Create an App to create a Slack API App

In the Create a Slack App popup, complete the App Name field, choose a Development Slack Workspace and then click the Create App button:

Fill out the Slack API App fields and click Create App
Fill out the Slack API App fields and click Create App

Next your will be directed to the Basic Information page of your newly created Slack app:

Basic Information dashboard for your Slack API App
Basic Information dashboard for your Slack API App

On this page, scroll down and click the Permissions button to configure permissions to allow your app to interact with the Slack API:

Click the Permissions button on the Basic Information page
Click the Permissions button on the Basic Information page

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:

Slack App Bot User OAuth Access Token
Slack App Bot User OAuth Access Token

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:

Slack API: Add an OAuth Scope
Slack API: Add an OAuth Scope

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:

Choose your Slack API scopes and permissions
Choose your Slack API scopes and permissions

After you choose your scopes, you’ll be asked to reinstall your app.

Click the reinstall your app link to begin the installation:

Reinstall Slack App after choosing scopes/permissions
Reinstall Slack App after choosing scopes/permissions

Then, choose a channel for your app from the drop-down list and then click the Allow button:

Choose a channel for your Slack API App
Choose a channel for your Slack API App

Step 3.) Choose your Slack API Endpoint

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:

Slack API Documentation
Slack API Documentation

In the Reference section, click on Methods to access the API Methods page:

Slack API Methods page
Slack API Methods/Endpoints 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:

team.info - Slack API endpoint documentation example
team.info – Slack API endpoint documentation example

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/

Step 4.) Enter your Slack API request into the Apipheny add-on

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. Do not include the carrots “<>” in the final URL.

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
Slack API URL and headers entered into the Apipheny add-on
Slack API URL and headers entered into the Apipheny add-on

Step 5.) Run the Slack API Request

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:

Slack API to Google Sheets: Slack data imported into Google Sheets using the Apipheny add-on
Slack API to Google Sheets: Slack data imported into Google Sheets using the Apipheny add-on

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, such as:

  • Save your Slack API request in the add-on
  • Schedule your Slack API request to refresh on a schedule basis
  • Make a POST request to the Slack API (if a POST endpoint is available)
  • Use the custom =APIPHENY() function to call the Slack API request inside your spreadsheet
  • Create a Slack API request in your sheet by referencing the value of a cell in the API URL with three curly braces eg. {{{Sheet1!A1}}}

If you want to connect Slack with Google Data Studio, just follow the same steps above, then connect your Google Sheets to Google Data Studio.

Import API to Google Sheets

Related Articles:

Related Posts

Leave a Comment