Search API Connector Documentation

Print

Import Notion Data to Google Sheets

In this guide, we’ll walk through how to pull data from the Notion API directly into Google Sheets, using the API Connector add-on for Sheets. We’ll first get an API key from Notion, and then set up a request to pull in data to your spreadsheet.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Get Your Notion Token

  1. Log in to Notion and click Settings & Members on the left side navigation menu
    notion-img1
  2. Click Integrations and then Develop your own integrations
    notion-img2
  3. Click + New Integration
    notion-img3
  4. You’ll be prompted to give your integration a name and a logo. These can be anything. Click Submit.
    notion-img4
  5. You will be presented with an internal token that you can use to make your API requests.
    notion-img5
  6. Scroll to the bottom of the page, make sure Internal integration is selected, and click Save. Congrats, you have your token! Copy it down as we’ll use it shortly.
    notion-img6

Part 2: Allow Access for your Token

By default, the token you’ve just created doesn’t have access to your Notion data until you explicitly share access.

To share access, navigate to your page or database, click the Share button in the upper right corner, and then into the People, emails, groups, or integrations textbox.
notion-img7

Select your integration and click Invite
notion-img8

Now your page is available via the API.

Part 2: Create Your API Request URL

For our first request, we’ll get metadata about a page.

  • Base URL: https://api.notion.com/v1
  • Endpoint: /pages/page_id

You can get your page ID from your page URL:
notion-img9

Putting it all together, we get the full API Request URL. Just substitute in your own page ID.

https://api.notion.com/v1/pages/02c4117b90854551a0752d67ec0dce0a

Part 3: Pull Notion API Data into Sheets

Now let’s get that data!

  1. Open up Google Sheets and click Extensions > API Connector > Open.
  2. In the Create Request tab, enter the Request URL we just created
    notion-img10
  3. Leave OAuth set to None
  4. Enter three headers. Where it says Bearer secret_xxxx, substitute in your Notion token from the first part of this article.
    • Authorization: Bearer secret_xxxxxxxxxxxx
    • Notion-Version: 2021-08-16
    • Content-Type: application/json
      notion-img11
  5. Create a new tab and click Set current to use that tab as your data destination.
  6. Name your request and click Run. A moment later you’ll see data about your Notion page populate your Google Sheet:
    notion-img12

Part 4: More Example API URLs

You can check the documentation for the full list of available endpoints, or try these example requests:

  • List databases
    GET https://api.notion.com/v1/databases/
  • Get records within a database (substitute in your database ID, and use a request body of {})
    POST https://api.notion.com/v1/databases/111111111/query
  • Get content from a page (substitute in your page ID)
    GET https://api.notion.com/v1/blocks/11111111/children

Part 5: Handle Pagination

By default, Notion API limits 100 responses per page as shown in their documentation:
notion-img13

To get more records, use the start_cursor parameter as described.

In API Connector you can do this automatically with the pagination handling feature, like this:

  • API Request URLenter your request URL
  • Pagination type: cursor
  • Next token parameter: start_cursor
  • Next token field: next_cursor (this is the column name containing the tokens)
  • Number of pagesenter the number of pages you’d like to fetch
    notion-img14

Part 6: API Documentation

Official API documentation: https://developers.notion.com/reference/intro

Previous Import Netflix Data from RapidAPI to Google Sheets
Next Import Okta Data to Google Sheets

Leave a Comment

Table of Contents