Skip to content

GustavoHennig/Notion-GoogleKeep-Sync

Repository files navigation

Google Keep & Notion Sync

A Python tool for two-way sync of notes between Google Keep and Notion.

Notion Setup Instructions

1. Create a Notion Account

2. Create a Page

  • In Notion, click the + New Page button in the sidebar.
  • Give your page a name (e.g., "Integration Test Page").

3. Create an Integration

  • Visit https://www.notion.so/my-integrations.
  • Click + New integration.
  • Fill in the integration name, select your workspace, and submit.
  • Save the generated "Internal Integration Token" (API key).

4. Add the Integration to Your Page (Add Connection)

  • Open your Notion page.
  • Click Share in the top right.
  • Under "Invite", search for your integration by name and invite it.
  • Set the integration's access level (usually "Can edit" or "Can read").

5. Use the Integration Token

  • Use the saved integration token in your application (e.g., set it in your .env file as NOTION_TOKEN).

Set the following variables in your .env file for Notion:

  • NOTION_TOKEN: Your Notion integration token (required)
  • NOTION_PARENT_PAGE_ID: The Notion page ID where the database will be created (optional, defaults to your workspace root)

Note: The integration must be added to each page or database you want to access via the API.

This Python app syncs your notes between Google Keep and Notion, using the gkeepapi and notion-client libraries.

Google Keep Setup Instructions

1. Obtain a Google Keep Master Token

  • Visit: https://accounts.google.com/EmbeddedSetup
  • When the page is stuck on "Loading...", open your browser's developer tools and read the value of the oauth_token cookie.
  • Use this value as your master token.

2. Configure Authentication

Set the following variables in your .env file:

  • EMAIL: Your Google account email (required)
  • GOOGLE_KEEP_TOKEN: Your Google Keep master token (optional, recommended for automation)

How the application finds your Google Keep master token (in order of precedence):

  1. Environment variable: Set GOOGLE_KEEP_TOKEN in your .env file.
    This will be used if present, even if a different token is stored in your system keyring.
  2. System keyring: If no environment variable is set, the app will use the token stored in your system keyring (if previously saved).
  3. Prompt: If neither is available, you will be prompted to enter the token at runtime.

If you do not set GOOGLE_KEEP_TOKEN, you will be prompted to enter it on first run.

Features

  • Two-way sync between Google Keep and Notion.
  • Automatically creates a Notion database ("GoogleKeepReplica") if it does not exist.
  • Syncs note title, content, labels, and last update date.
  • Keeps both platforms up to date based on the most recent changes.

Setup

  1. Clone this repository (if not already done).

  2. Create and activate a virtual environment:

    On Windows:

    python -m venv venv
    venv\Scripts\activate
    

    On macOS/Linux:

    python3 -m venv venv
    source venv/bin/activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Set up environment variables:

    Create a .env file in the project root with the following content:

    [email protected]
    NOTION_TOKEN=your_notion_integration_token
    

    Make sure your Notion integration has access to at least one page in your workspace.

Usage

  1. Run the app:

    python main.py
    
  2. Login:

    • The app will prompt for your Google email and master token if not already saved.
    • If you have 2FA enabled, use an app password or follow the instructions for master token.
  3. Sync:

    • The script will check for the "GoogleKeepReplica" database in Notion and create it if needed.
    • Notes will be synced both ways based on the last update date.

Available .env Settings

  • EMAIL: Your Google account email (required for Google Keep sync)
  • GOOGLE_KEEP_TOKEN: Your Google Keep master token (optional, recommended for automation)
  • NOTION_TOKEN: Your Notion integration token (required for Notion sync)
  • NOTION_PARENT_PAGE_ID: The Notion page ID where the database will be created (optional, defaults to your workspace root)

.env Example

[email protected]
GOOGLE_KEEP_TOKEN=your_google_keep_master_token
NOTION_TOKEN=your_notion_integration_token
NOTION_PARENT_PAGE_ID=your_notion_parent_page_id

License

About

A Python tool for two-way sync of notes between Google Keep and Notion.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages