OneNote to Markdown (and Obsidian.md)

GitHub

github.com/SjoerdV/ConvertOneNote2MarkDown
OneNote-to-MD.md: Converting One Note to Markdown

YouTube

Easily Convert OneNote to Markdown (and Obsidian.md)
OneNote – Export Pages, Sections, or Workbooks into Word (easily!)

Requirements

Python

> pip install -r requirements.txt
Collecting pywin32
  Downloading pywin32-306-cp311-cp311-win_amd64.whl (9.2 MB)
     ---------------------------------------- 9.2/9.2 MB 32.8 MB/s eta 0:00:00
Collecting pymupdf
  Downloading PyMuPDF-1.22.3-cp311-cp311-win_amd64.whl (11.7 MB)
     ---------------------------------------- 11.7/11.7 MB 36.4 MB/s eta 0:00:00
Installing collected packages: pywin32, pymupdf
Successfully installed pymupdf-1.22.3 pywin32-306


> python convert.py
!!WARNING!! Page Failed: C:\Users\bacr\Desktop\OneNoteExport\Andreas @ ZHAW\Quick Notes\000_OneNote- one place for all of your notes.md
!!WARNING!! Page Failed: C:\Users\bacr\Desktop\OneNoteExport\Andreas @ ZHAW\Quick Notes\001_OneNote Basics.md
!!WARNING!! Page Failed: C:\Users\bacr\Desktop\OneNoteExport\Andreas @ ZHAW\Quick Notes\002_Untitled page.md
!!WARNING!! Page Failed: C:\Users\bacr\Desktop\OneNoteExport\Andreas @ ZHAW\Quick Notes\003_Untitled page.md
Traceback (most recent call last):
  File "U:\onenote-to-markdown\convert.py", line 134, in <module>
    handle_element(onenote, child)
  File "U:\onenote-to-markdown\convert.py", line 111, in handle_element
    handle_element(onenote, c2, os.path.join(path, safe_str(elem.attrib['name'])), i)
  File "U:\onenote-to-markdown\convert.py", line 113, in handle_element
    hier2 = onenote.GetHierarchy(elem.attrib['ID'], win32.constants.hsPages, "")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\bacr\AppData\Local\Temp\gen_py\3.11\F2A7EE29-8BF6-4A6D-83F1-098E366C709Cx0x1x0\IApplication.py", line 63, in GetHierarchy
    return self._ApplyTypes_(1610743808, 1, (24, 0), ((8, 1), (3, 1), (16392, 2)), 'GetHierarchy', None,bstrStartNodeID
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\bacr\Miniconda3\envs\onenote\Lib\site-packages\win32com\client\__init__.py", line 574, in _ApplyTypes_
    self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.com_error: (-2147023174, 'Der RPC-Server ist nicht verfügbar.', None, None)
!!!Error!!! Hint: Make sure OneNote is open first.

=> RPC server is unavailable error no=-2147023174

RPC server is unavailable error no=-2147023174

PowerShell

> .\convert3.ps1

Notebook: Andreas @ ZHAW
Section: Andreas @ ZHAW\Quick Notes
Creating DOCX: C:\Users\bacr\Desktop\OneNoteExport\Andreas @ ZHAW\Quick Notes\00_OneNote_ one place for all of your notes.docx
ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Exception calling "Publish" with "4" argument(s): "Der Remoteprozeduraufruf ist fehlgeschlagen. (Exception from HRESULT: 0x800706BE)"

==> Error -2147023174 (dec) translates to 800706BA (hex), 'the RPC server is unavailable'.

Sie können Rollen und Features nicht anzeigen und erhalten Fehlercode 0x800706BE in Server-Manager

Leave a Reply

Your email address will not be published. Required fields are marked *