Introduction
In this tutorial, you'll learn how to migrate your Evernote notebooks to Notion using the Notion API. This practical guide will show you how to extract data from Evernote and programmatically create equivalent Notion pages, helping you make the transition from Evernote to Notion. The migration process involves authenticating with both services, extracting your Evernote content, and building Notion pages with proper formatting.
Prerequisites
Before beginning this tutorial, you'll need:
- Python 3.7 or higher installed on your system
- Basic understanding of Python programming concepts
- An Evernote account with notebooks to migrate
- A Notion account with a workspace created
- Notion integration token with appropriate permissions
Step-by-step instructions
1. Set up your development environment
1.1 Install required Python packages
First, create a virtual environment and install the necessary packages for working with both Evernote and Notion APIs.
python -m venv notion_migration_env
source notion_migration_env/bin/activate # On Windows: notion_migration_env\Scripts\activate
pip install evernote3 notion-client requests
This creates an isolated environment for our project and installs the Evernote SDK and Notion client libraries we'll need for API communication.
1.2 Create your project structure
Set up a basic project structure with a main script and configuration files.
mkdir evernote_to_notion
cd evernote_to_notion
touch config.py
touch migration_script.py
touch requirements.txt
2. Configure your API credentials
2.1 Get your Evernote API token
Visit the Evernote Developer Portal to obtain your API token. You'll need to create an application and generate a developer token. Add this token to your config.py file:
# config.py
EVERNOTE_TOKEN = "your-evernote-developer-token-here"
NOTION_TOKEN = "your-notion-integration-token-here"
NOTION_DATABASE_ID = "your-notion-database-id-here"
The Evernote token allows us to access your notebook data, while the Notion token enables us to create pages in your workspace.
2.2 Set up Notion integration
Create a new integration in your Notion workspace:
- Go to Notion Integrations
- Click "New integration"
- Name it "Evernote Migration"
- Grant it permissions to create pages and read databases
- Copy the integration token and add it to your config
3. Extract data from Evernote
3.1 Create the Evernote connection
Now, let's establish our connection to Evernote and fetch your notebooks:
# migration_script.py
import evernote.edam.notestore.ttypes as Types
from evernote.api.client import EvernoteClient
from config import EVERNOTE_TOKEN
def connect_to_evernote():
client = EvernoteClient(token=EVERNOTE_TOKEN, sandbox=False)
note_store = client.get_note_store()
return note_store
# Fetch all notebooks
note_store = connect_to_evernote()
notebooks = note_store.listNotebooks()
print(f"Found {len(notebooks)} notebooks")
for notebook in notebooks:
print(f"- {notebook.name}")
This code connects to your Evernote account and lists all your notebooks, which is the first step in identifying what content to migrate.
3.2 Extract notes from a notebook
Next, we'll extract individual notes from a specific notebook:
def extract_notes_from_notebook(note_store, notebook_guid):
# Create a note filter to get all notes from the notebook
note_filter = Types.NoteFilter()
note_filter.notebookGuid = notebook_guid
# Get the list of note GUIDs
note_guids = note_store.findNotes(note_filter, 0, 1000).notes
notes = []
for guid in note_guids:
note = note_store.getNote(guid, True, True, True, True)
notes.append({
'title': note.title,
'content': note.content,
'created': note.created,
'updated': note.updated
})
return notes
This function fetches all notes from a given notebook, including their content, creation dates, and modification dates.
4. Transform and prepare data for Notion
4.1 Parse Evernote content
Evernote's content is in XML format, so we need to extract the text content:
import re
def parse_evernote_content(content):
# Remove XML tags and extract text
clean_content = re.sub(r'<[^>]+>', '', content)
# Replace common Evernote formatting with plain text
clean_content = clean_content.replace('\n\n', '\n')
return clean_content
# Example usage
for note in notes:
clean_text = parse_evernote_content(note['content'])
print(f"Title: {note['title']}")
print(f"Content: {clean_text[:100]}...")
This step ensures we extract clean text from Evernote's XML structure, which is necessary for importing into Notion's format.
4.2 Format for Notion
Notion requires specific formatting for content blocks. Create a function to convert your content:
def format_for_notion(note_data):
blocks = [
{
"object": "block",
"type": "heading_1",
"heading_1": {
"text": [
{
"type": "text",
"text": {
"content": note_data['title']
}
}
]
}
},
{
"object": "block",
"type": "paragraph",
"paragraph": {
"text": [
{
"type": "text",
"text": {
"content": note_data['content']
}
}
]
}
}
]
return blocks
This function creates a proper Notion block structure that will render correctly in Notion pages.
5. Create Notion pages
5.1 Initialize Notion client
Set up your Notion client with the API token:
from notion_client import Client
from config import NOTION_TOKEN
notion = Client(token=NOTION_TOKEN)
# Test connection
try:
notion.users.me()
print("Successfully connected to Notion")
except Exception as e:
print(f"Connection failed: {e}")
Verifying the connection ensures that your API token is valid and has proper permissions.
5.2 Create pages in Notion
Finally, create Notion pages for each of your Evernote notes:
def create_notion_page(note_data):
page = notion.pages.create(
parent={
"database_id": "your-database-id-here"
},
properties={
"Name": {
"title": [
{
"text": {
"content": note_data['title']
}
}
]
}
},
children=format_for_notion(note_data)
)
return page
This function creates a new page in your Notion database with the note title as the page name and the note content as children blocks.
6. Complete migration process
6.1 Run the full migration
Combine all the steps into a complete migration process:
def migrate_notebook(notebook_guid):
note_store = connect_to_evernote()
notes = extract_notes_from_notebook(note_store, notebook_guid)
for note in notes:
try:
page = create_notion_page(note)
print(f"Successfully migrated: {note['title']}")
except Exception as e:
print(f"Failed to migrate {note['title']}: {e}")
# Run migration for your first notebook
migrate_notebook(notebooks[0].guid)
This final function orchestrates the entire migration process, handling errors gracefully and providing feedback on the success of each note migration.
Summary
In this tutorial, you've learned how to migrate data from Evernote to Notion using their respective APIs. You've set up the development environment, configured API credentials, extracted notes from Evernote, transformed the content into Notion-compatible formats, and created new pages in Notion. This automated approach allows you to preserve all your valuable information during your transition from Evernote to Notion, making the migration process much more efficient than manual copying.



