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 for Google Sheets

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.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new

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.

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.


API Tutorials



API Knowledge

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?