Exports notes and lists from Google Keep and imports them into your Notion.
Supports exporting:
- Notes
- TODO lists
- Images and audio (unsupported in recent Notion API versions, stay tuned for updates)
- Categorization via labels
This script requires Python 3.9+, https://github.com/kiwiz/gkeepapi, https://github.com/ramnes/notion-sdk-py, and a couple more libraries to run. Install the pre-requisite libraries via Pip3:
pip3 install -r requirements.txt
Optional: make the script executable:
chmod +x gkeep2notion.py
On some systems the authentication fails even with valid credentials. This may happen because of three reasons:
- You have enabled 2FA on your account
- Google issues a CAPTCHA for your IP address
- SSL certificate validation fails.
To fix the 2FA problem:
You need to create an app specific password for the script.
- Go to https://myaccount.google.com/apppasswords
- Login to your account
- Under the
Select the app and device you want to generate the app password for.
section:- Select
Other(Custom name)
from theSelect app
dropdown - Enter some name like
gkeep2notion
and click onGenerate
button - Copy password from the popup and click Done
- Select
- Use this copied password in your terminal when script prompts for password
To fix the CAPTCHA problem:
Try using the Unlock CAPTCHA link before retrying login.
To try fixing the SSL problem:*
Revert to an older version of the following library:
pip3 install requests==2.23.0
Before use, copy config.example.ini to config.ini and edit its contents. See configuration explanation below:
[gkeep]
email=your_name@gmail.com # Your Google account
import_notes=true # Set to false if you don't want to import notes
import_todos=true # Set to false if you don't want to import TODO lists
import_media=true # Set to false if you don't need to import images and audio
[notion]
token=Copy it from your Notion integratin # See documentation below
root_url=https://notion.so/PAGE-ID Create a root url in your Notion # See documentation below
The importer needs to access your Notion account and it needs to know the root URL in which to import all the Google Keep contents.
To get a Notion authentication token:
- Go to your Notion integrations
- Click "Create new integration"
- Enter any name, e.g.
gkeep2notion
. As per Integration type, choose Internal integration. In the Capabilities make sure this integration can Read, Update, and Insert content. - After creating the integration copy the "Internal Integration Token" value to the
token
in yourconfig.ini
.
This script imports all the content under a certain page in Notion that has to exist already. It is recommended to create a special page for the imported content, and then migrate it to your regular Notion structure from there.
- Create a new page in Notion e.g. "Google Keep import"
- Click on
•••
button on top right of the page and select "Add Connections" (at the bottom) from the menu. - Search for your integration name and select it. You should press "Confirm" on the dialog that will appear. This will make the page accessible to your integration.
- Copy the URL of the page in the address bar or use "Copy link" in the context menu of the navigation bar
- Paste that link to
root_url
in the config.ini.
The first time you run gkeep2notion
it will ask for your Google Account's password to authenticate into your Google Keep account. After obtaining an authentication token, gkeep2notion
saves it in your system's keyring. Next time you won't need to enter the password again.
Note: export/import takes a considerable amount of time. Especially when working with notes containing media files. So you may want to try importing a subset of your records before importing everything.
By default gkeep2notion exports everything in your Google Keep account and imports it into Notion. It can be done as simple as:
./gkeep2notion.py
You can use the search function built into Google Keep to import notes matching a search query:
./gkeep2notion.py -q 'Orange apple'
You can import notes and tasklists containing specific label(s) in Google Keep using the -l
option.
An example with one label:
./gkeep2notion.py -l cooking
An example with multiple labels, comma separated:
./gkeep2notion.py -l 'work, business, management'
This tool uses the unofficial Google Keep API for Python by kiwiz. Google Keep is of course a registered trademark of Google and neither the API nor this script are affiliated with Google, Inc.
Thanks to ramnes for the unofficial Notion Python SDK. Neither that API nor this script are affiliated with Notion. Notion is a trademark of Notion Labs, Inc.