Skip to main content

Import Evernote ENEX files to Notion

Project description

enex2notion

PyPI version Python Version tests codecov

Easy way to import Evernote's *.enex files to Notion.so

Notion's native Evernote importer doesn't do it for me, so I decided to write my own. Thanks to Cobertos and md2notion for inspiration and Jamie Alexandre for notion-py.

You can either use Evernote native export or try out my other tool, evernote-backup, to export *.enex files from Evernote.

What is preserved

  • Embedded files and images are uploaded to Notion
    • nested images will appear after paragraph
  • Text formatting (bold, italic, etc) and colors
  • Tables are converted to the new format (no colspans though)
  • Web Clips
    • as plain text or PDFs, see below
  • Everything else basically

What is lost

  • Paragraph alignment
  • Subscript and superscript formatting
  • Custom fonts and font sizes
  • Tasks
  • Encrypted blocks
    • just decrypt them before export

Installation

Download the latest binary release for your OS.

With Homebrew

$ brew install vzhd1701/tap/enex2notion

With PIP

$ pip install enex2notion

Python 3.7 or later required.

Or, since enex2notion is a standalone tool, it might be more convenient to install it using pipx:

$ pipx install enex2notion

From source

This project uses poetry for dependency management and packaging. You will have to install it first. See poetry official documentation for instructions.

$ git clone https://github.com/vzhd1701/enex2notion.git
$ cd enex2notion/
$ poetry install --no-dev
$ poetry run enex2notion

Important notice for Apple M1 MacOS users. This tool depends on PyMuPDF. Pre-compiled binaries of this package are not available for arm64 architecture yet, which means that PIP will have to compile them for you. PyMuPDF compilation requires mupdf, freetype and swig. If you install using Homebrew, it will download all required packages automatically.

Usage

$ enex2notion --help
usage: enex2notion [-h] [--token TOKEN] [OPTION ...] FILE/DIR [FILE/DIR ...]

Uploads ENEX files to Notion

positional arguments:
  FILE/DIR                   ENEX files or directories to upload

optional arguments:
  -h, --help                 show this help message and exit
  --token TOKEN              Notion token, stored in token_v2 cookie for notion.so [NEEDED FOR UPLOAD]
  --root-page NAME           root page name for the imported notebooks, it will be created if it does not exist (default: "Evernote ENEX Import")
  --mode {DB,PAGE}           upload each ENEX as database (DB) or page with children (PAGE) (default: DB)
  --mode-webclips {TXT,PDF}  convert web clips to text (TXT) or pdf (PDF) before upload (default: TXT)
  --add-pdf-preview          include preview image with PDF webclips for gallery view thumbnail (works only with --mode-webclips=PDF)
  --add-meta                 include metadata (created, tags, etc) in notes, makes sense only with PAGE mode
  --tag TAG                  add custom tag to uploaded notes
  --condense-lines           condense text lines together into paragraphs to avoid making block per line
  --condense-lines-sparse    like --condense-lines but leaves gaps between paragraphs
  --done-file FILE           file for uploaded notes hashes to resume interrupted upload
  --log FILE                 file to store program log
  --verbose                  output debug information
  --version                  show program's version number and exit

Input

You can pass single *.enex files or directories. The program will recursively scan directories for *.enex files.

Token & dry run mode

The upload requires you to have a token_v2 cookie for the Notion website. For information on how to get it, see this article.

The program can run without --token provided though. It will not make any network requests without it. Executing a dry run with --verbose is an excellent way to check if your *.enex files are parsed correctly before uploading.

Upload continuation

The upload will take some time since each note is uploaded block-by-block, so you'll probably need some way of resuming it. --done-file is precisely for that. All uploaded note hashes will be stored there, so the next time you start, the upload will continue from where you left off.

All uploaded notebooks will appear under the automatically created Evernote ENEX Import page. You can change that name with the --root-page option. The program will mark unfinished notes with [UNFINISHED UPLOAD] text in the title. After successful upload, the mark will be removed.

Upload modes

The --mode option allows you to choose how to upload your notebooks: as databases or pages. DB mode is the default since Notion itself uses this mode when importing from Evernote. PAGE mode makes the tree feel like the original Evernote notebooks hierarchy.

Since PAGE mode does not benefit from having separate space for metadata, you can still preserve the note's original meta with the --add-meta option. It will attach a callout block with all meta info as a first block in each note like this.

Web Clips

Due to Notion's limitations Evernote web clips cannot be uploaded as-is. enex2notion provides two modes with the --mode-webclips option:

  • TXT, converting them to text, stripping all HTML formatting [Default]

    • similar to Evernote's "Simplify & Make Editable"
  • PDF, converting them to PDF, keeping HTML formatting as close as possible

Since Notion's gallery view does not provide thumbnails for embedded PDFs, you have the --add-pdf-preview option to extract the first page of generated PDF as a preview for the web clip page.

Misc

The --condense-lines option is helpful if you want to save up some space and make notes look more compact. Example.

The --condense-lines-sparse does the same thing as --condense-lines, but leaves gaps between paragraphs. Example.

The --tag option allows you to add a custom tag to all uploaded notes. It will add this tag to existing tags if the note already has any.

Examples

Checking notes before upload

$ enex2notion --verbose my_notebooks/

Uploading notes from a single notebook

$ enex2notion --token <YOUR_TOKEN_HERE> "notebook.enex"

Uploading with the option to continue later

$ enex2notion --token <YOUR_TOKEN_HERE> --done-file done.txt "notebook.enex"

Getting help

If you found a bug or have a feature request, please open a new issue.

If you have a question about the program or have difficulty using it, you are welcome to the discussions page. You can also mail me directly, I'm always happy to help.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enex2notion-0.2.13.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

enex2notion-0.2.13-py3-none-any.whl (46.9 kB view details)

Uploaded Python 3

File details

Details for the file enex2notion-0.2.13.tar.gz.

File metadata

  • Download URL: enex2notion-0.2.13.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.13.0-1023-azure

File hashes

Hashes for enex2notion-0.2.13.tar.gz
Algorithm Hash digest
SHA256 bf699e83c373f184785d85d567cfed9fb7f3259b2477d522e92c5d77abfd78d3
MD5 a107b2c5d76ebb325e53f2f3526f5664
BLAKE2b-256 32934f6832a54db5075c2f74a72b56e67595d032097ec48279eec20177ecc5d1

See more details on using hashes here.

File details

Details for the file enex2notion-0.2.13-py3-none-any.whl.

File metadata

  • Download URL: enex2notion-0.2.13-py3-none-any.whl
  • Upload date:
  • Size: 46.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.13.0-1023-azure

File hashes

Hashes for enex2notion-0.2.13-py3-none-any.whl
Algorithm Hash digest
SHA256 744fed33ab773d84ffb46872679f6b5be564e6c7a265aba5b5c58f0146080324
MD5 53dfca9bab12c496a7a23e2df169e663
BLAKE2b-256 4c37f04edae4e3585195fcd5d03a9d3de5a5c94dfa409ba68a5b891b74362378

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page