A Node script that exports Kobo highlights to a Notion database. I wrote a detailed writeup of how I wrote this code on my blog.
You'll need Git and Node installed on your computer.
You'll also need to configure a Notion "integration" that has access to the database you wish to use (your "library" database). Notion has instructions on how to set up an integration here, and you can give it access to your library database by sharing the database with the integration.
-
In your terminal, clone this repository by running the following command:
git clone https://github.com/juliariec/export-kobo-to-notion.git
-
Navigate inside the folder and run
npm install
to install the necessary modules. -
Create a file called
.env
. Inside the file, you'll need to set two variables:NOTION_TOKEN
, which is the internal integration token associated with your Notion integration. You can find this here, and it will look likesecret_TY78iopwv
(but longer).NOTION_DATABASE_ID
, which is the ID of the library database. You can find this in the URL of the database page: the URL will have a 32 digit ID located between your workspace name and the ? symbol: it will look likehttps://www.notion.so/username/776yv4nanf6qx0bdttznd9upfljupb11?v=s9...
, where the ID is776yv4nanf6qx0bdttznd9upfljupb11
So your
.env
file will look like this:NOTION_TOKEN=secret_TY78iopwv NOTION_DATABASE_ID=776yv4nanf6qx0bdttznd9upfljupb11
-
Connect your Kobo to your computer and open it in File Explorer. Navigate into the
.kobo
directory and copy the file calledKoboReader.sqlite
, and then paste it into theexport-kobo-to-notion
folder and rename ithighlights.sqlite
. -
Go to your Notion library database and make sure that the database contains a "Title" property with the name of the book, and a "Highlights" checkbox property which defaults to unchecked. (The script will match books based on the title, and then see if highlights have already been uploaded: if not, it will upload them, and then set the "Highlights" box to checked).
-
Run the script with the command
npm start
, and then check your Notion database to confirm that it worked.