How to connect the Quora API to Google Sheets

Quora is a famous question-and-answer website. We can use the Quora API to import data from Quora into Google Sheets. In this tutorial, we’ll show you how to connect the Quora REST API to the Google Sheets API in 6 steps:

  1. Install the Apipheny add-on
  2. Register a Quora client
  3. Obtain an access token
  4. Choose a Quora API endpoint
  5. Enter the Quora API request into the Apipheny add-on
  6. Run the Quora API request in your Google Sheet

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

To pull data from the Quora API to Google Sheets, 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, save API requests, schedule API requests, and more. 

1. Install Apipheny by opening the following link on desktop and then clicking the Install button on the page: https://apipheny.io/install

2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons or Extensions option in the top menu. In the add-ons menu, you should see Apipheny.

Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheet.

Opening the Apipheny add-on in Google Sheets
Opening the Apipheny add-on in Google Sheets

Step 2.) Register a client

At the moment, registering an OAuth client requires contacting the Quora support team at ads-api-help@quora.com. In your email, include this required information:

  • At least one redirect URI, to which authorization codes may be sent (eg. the URL for your website)
  • A Quora user to associate the client to (your account email address)
  • A name for your application (choose any name)

Once registration is complete, you’ll be able to view your account’s client ID and client secret, when you visit this URL: https://www.quora.com/ads/oauth_client_data

Quora OAuth Client Data
Quora OAuth Client Data

Step 3.) Obtain an access token

In your browser’s address bar, paste the following link and then press Enter:

https://www.quora.com/_/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URL &response_type=code&scope=ads_read&state=123
  • Make sure to replace YOUR_CLIENT_ID and YOUR_REDIRECT_URL with the real values that you obtained in the previous step

When you visit the URL, an Authorization page will then be displayed. Click the Accept button to continue:

Quora Permissions page
Quora Permissions page

The browser will then navigate to the redirect URL that you provided when you registered your client. One query parameter (a code) will be added to your browser’s address bar, at the end of the redirect URL. The code parameter is a single use login code that we will now use to acquire an access token:

Getting the code in browser
Getting the code in the browser address bar

Open up a terminal and compose the following curl command:

curl -X POST -d "client_id=YOUR_CLIENT_ID" -d "client_secret=YOUR_CLIENT_SECRET " -d "code=CODE " -d "grant_type=authorization_code" --data-urlencode "redirect_uri=YOUR_REDIRECT_URL" https://www.quora.com/_/oauth/token

You’ll need to replace a few values:

  • YOUR_CLIENT_ID  and YOUR_CLIENT_SECRET – these are the values that you previously obtained from Quora
  • CODE – This should be the value of the code query parameter from the previous step
  • YOUR_REDIRECT_URL – This must be the redirect URL that you’ve sent to the Quora team in your initial email, when you registered your client
Console Window
Console Window

Your access token will be displayed in the response.

Step 4.) Choose a Quora API endpoint

In this section, we’ll show you how to browse the Quora API documentation to find an endpoint that retrieves the specific information you need from your Quora account. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 5.

First, open the Quora API documentation page: https://www.quora.com/ads/api9169a6d6e9b42452d500a61717d87d15d5fa49ec5b53030741178130#section/Overview

The menu on the left contains general information about the Quora API and a list of API endpoints:

Quora API Documentation Page
Quora API Documentation Page

An example endpoint is Get data for an account, which gets a paginated list of data, either for each entity in the requested level, or each time window in a time series. The URL for this endpoint is:

https://api.quora.com/ads/v0/accounts/account_id
  • account_id must be replaced with a real account id

The documentation for this endpoint contains the cURL command, example responses, the necessary scopes (ads_read), the path parameters and the query parameters:

Quora Endpoint Documentation
Quora Endpoint Documentation

All API calls to the Quora API should be made to the https://api.quora.com/ads/v0/ base domain.

Step 5.) Enter the Quora API request into the Apipheny add-on

Okay, we’re in the home stretch. 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) as required by your Quora API endpoint. For this example, we are using the GET method.

API URL: In Step 4, I explained how you can find the Quora API endpoint that you need. Now copy your complete API URL into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query.

For this example, we are using the Get current user endpoint, which provides information about the Quora user which is currently authorized to use the Reporting API. The corresponding URL for this endpoint is:

https://api.quora.com/ads/v0/me

If you’re following the same example, just copy and paste this URL into Apipheny.

Headers: In the Headers section of the Apipheny add-on, add one row with the following key and value:

Header
Key:
Authorization
Value:
Bearer your_token

In the header value, make sure to replace your_token with the value of the token you obtained previously, in Step 3. There should be a literal space between Bearer and your_token.

Here’s what our API request looks like in Apipheny:

 Quora API request entered into Apipheny
Quora API request entered into Apipheny

Step 6.) Run the Quora API request in your Google Sheet

The last step is to click the Run button at the bottom of the Apipheny add-on and then your Quora data will be imported into your Google Sheet.

 Quora data imported into Google Sheets
Quora data imported into Google Sheets

After making a successful request to the Quora API, try querying a different Quora API endpoint, or try using one of the more advanced features in the Apipheny add-on, such as:

  • Save and schedule your Quora API request
  • Make a POST request to the Quora API (if available)
  • Use the custom =APIPHENY() function to call the Quora API request inside your spreadsheet
  • Create an API request by referencing the value of a cell in the API URL with three curly braces eg. {{{Sheet1!A1}}}

More API Tutorials

Related Posts