How to migrate many OneNotes to Obsidian from scratch (2k+ files)

How to migrate many OneNotes to Obsidian from scratch (2k+ files)

An avid OneNoter for years that just found Obsidian and finally found THE(?) tool to actually see/connect what you did before?

… but all my notes are locked up in M$ jail and there are NO way I’m gonna manually export those, one by one… HAAAALP!

Fear not, the Obsidian community to the rescue!

This exact workflow exported my 2000-ish OneNotes and embedded files, with retained structure links (phew!). You WILL have to clean up a bit inside Obsidian after the export, but at least the note file structure and data are freed up into .md notes… you’re not starting from scratch!

Huge thanks to the creators of the assorted scripts, details of functionality and further installation instructions can be read on the respective resource pages. I’ve incorporated those I found was vital in the instructions below. YMMV.

Base requirements

  • Windows >= 10
  • Windows Powershell 5.x and above
  • Microsoft OneNote >= 2016
  • (Microsoft Word >= 2016)
  • Admin rights on your computer
  • Basic commandline proficiency (ie know how to navigate to/run a specific folder/program in a PowerShell/command line environment (cd <‘filename’> /cd… )


Stuff to get/install

  • Windows PowerShell (Core functionality on win10-machines)
  • Install Pandoc via Chocolatey: Pandoc
  • Install stand-alone desktop OneNote, NOT web version: Free of charge
  • Install Onetastic Onetastic
    (relevant macro to run is attached in Convert…4Obsidian-package below)
  • Get ConvertOneNote2MarkDown4Obsidian - rab-bit fork
    • Exact release I worked with: v2.5

Prep file structure / programs

  • Create a clean, short, absolute file path for the script to work in, in root. Ie “C:\temp\notes”
  • Unzip the downloaded ConvertOneNote2MarkDown4Obsidian-zip in a folder with an ‘easy to remember’-path.
    • You will probably need to tweak the export some times before you’re satisfied and thus you might need to re-type the path. Long paths are a nuisance…
  • Open Windows PowerShell as Admin

Prep OneNote

  • Open OneNote as Admin (right-click on the OneNote icon in startmenu, choose ‘Run as Administrator’)
  • Close all notebooks that you DON’T want to export. All notebooks currently loaded (open) in OneNote will be converted.
  • Make sure the open notebooks doesn’t resides in any local harddrive(s). If any are locally saved, move them to OneDrive so the conversion script can find them.
  • Remove all password protection(s) on any OneNote file or section
  • Flatten nested Section groups deeper than 4.
    • TIP: Rename the children/leaf sections before you move them upwards to parent section level to denote the old structure. Much easier to re-create the original structure in Obsidian afterwards
  • Install Onetastic
  • Run Onetastic script (included in the conversion4Obsidian kit) once per open notebook.

Prep Obsidian

  • Create a new Sandbox vault to check the migration result in.
    • If you’re not brand spanking new to Obsidian, chances are that you already have a small vault going and you do not want to inadvertly delete other files while you fiddle with the exports. It’s nice to be able to wipe the whole vault and redo.

Migration process

  1. Make sure that you’ve done the preparation steps. All of them will affect the outcome/probable success rate of the migration process.
  2. Make sure PowerShell and OneNote are open and running in Admin mode
  3. In PowerShell, navigate to the folder you unzipped ConvertOneNote2MarkDown4Obsidian in.
  4. Run ConvertOneNote2MarkDown-v2.ps1
    1. The choices you make in the initial ‘setup’ will affect the outcome of the script. Re-run the script until you are satisfied with the outcome.
    2. NB! When the export runs, the script will throw (the same) exeption like no tomorrow (one for each file-call, by the looks of it), so the log will look like a blood red carnage of errors. It still works tho.
  5. Open up the script working folder (“C:\temp\notes”) in a file explorer window and watch the script bulding up your files … it’s quite mesmerizing :).
    Also a non -evolving file structure is a good heads up that the script have crashed.
  6. Leave the script and OneNote open and running. This is a good time to grab something yummy to drink.
    1. Do NOT fiddle with the OneNote-window, just open stuff above it, if you need to continue working somewhere else.
  7. When the script is done, a summary in white will show up.
  8. Manually copy the result from /notes to your new Obsidian Sandbox vault via a file explorer window. Check the results, don’t forget Graph view. Such satisfaction!
  9. If all looks as expected: SUCCESS!! Celebrate!
  10. Move all the .md-files and media folder to your normal vault. Done!
    1. Aka …begin the cleaning up. TIP: Batch clean out doubles, weird pictures/media files in a file explorer window instead of one by one inside Obsidian… You can thank me later :smiley: Culling is nice! Have fun :smiley:


  1. If the result looks like a spiderweb made on drugs, a tatched roof or a strange orphan starred sky, or you are missing half the notes… time for a re-run from step 4.
    1. Remember to clear out the .md and media files (keep the docx-folder) in c:\temp\notes between every new run, otherwise you WILL have doubles galore to clean out.

This is essentially a duplicate of this thread and, and a copy-paste of the Readme, for the tool that I made.

It is out of date anyway, given that I passed the project off to other people who have made considerable improvements. I’ve linked to the new tool in the original thread.

@nixsee Weell. Yes, it is absolutely based on your work, and a few others that forked it. I got rab-bits fork to work, unfortunately not yours, tho I tried). I take exactly NO cred for actually creating the scripts, I also did thank you all, albeit as a contributor group?

What I DO take cred for, however, is to have merged the whole process of quite a few scripts (and descriptions) into ONE single, step by step workflow proven for a massive amount of files, instead of having to read tons of git-conversations to understand how to do stuff… and to wonder whether the scattered git-repos would work on a ‘slightly’ larger note set than a few hundred that others had reported.

Call me stupid, but as a novice of both git, pandoc, chocolatey and Obsidian, this step by step ‘holding hand’ instruction is what I would have love to read when I started this process. YMMV.

Btw… Isn’t it the whole point of Obsidian to expand and publish your take on others thoughts/work where you see it needed? Anyway, I’m sorry to have offended you. Was not my intention. Thank you so much for doing the initial (massive) leg work!

No offense taken. I was just pointing out that this was redundant and out of date. I strongly recommend checking out the most recent version. The new maintainers have done a fantastic job of improving it far beyond what I had hacked together.


First: Thank you so much to all the parties involved in this! This is what the internet is for!

I am trying this, and I am following the instructions exactly (i think)
I am getting this error

Please help!

OneNote to Obsidian Converter

Looks like there’s a converter now (just saw this on Reddit):

1 Like

This OneNote convertor works really well. Followed these installations instructions first: GitHub - theohbrothers/ConvertOneNote2MarkDown: Ready to make the step to Markdown and saying farewell to your OneNote, EverNote or whatever proprietary note taking tool you are using? Nothing beats clear text, right? Read on!
The instructions are clear.

Learned a few things in the process of converting 2.79GB of Microsoft OneNote Files into markdown and linked media files.
Hopefully the following notes will help others looking to do the same thing.

[1] So, thought it might be useful to embed some of the original OneNotes structure into the markdown, so did a few minor edits to the .ps1 script that created a bunch of new tags for each of the following:

Type: #OneNote-Notebook
Reference: <a link to the .docx file created by the convertor script, so there’s something easy to refer to just in case the converted markdown info is scrambled due to the data complexity contained in the original onenote page>

[2] I had to reconfigure Microsoft Powershell security settings using the following commands.

Then take the following steps to run the Powershell scripts. Note these have been edited and the changes are included below.

1. To view the execution policies

PS C:\Users\Rohan.000\desktop\OneNote to MarkDown - PowerShell Convertor\ConvertOneNote2MarkDown-master> Get-ExecutionPolicy -List

2. To enable powershell to run the script in CurrentUser policy. Disconnect internet before doing this!

PS C:\Users\Rohan.000\desktop\OneNote to MarkDown - PowerShell Convertor\ConvertOneNote2MarkDown-master> Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

3. To run the powershell script

PS C:\Users\Rohan.000\desktop\OneNote to MarkDown - PowerShell Convertor\ConvertOneNote2MarkDown-master> .\ConvertOneNote2MarkDown-v2.ps1

4. To disable powershell to run the script in CurrentUser policy

PS C:\Users\Rohan.000\desktop\OneNote to MarkDown - PowerShell Convertor\ConvertOneNote2MarkDown-master> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

[3] Made some minor edits to the ‘config.ps1’ file and set the following parameters for the conversion. The ‘$mdFileNameAndFolderNameMaxLength = 50’ was the main parameter that needed some trial and error to reduce markdown file names getting cut off.

$dryRun = 1
$notesdestpath = ‘c:\temp\notes’
$targetNotebook = ‘’
$usedocx = 1
$keepdocx = 2
$docxNamingConvention = 1
$prefixFolders = 1
$mdFileNameAndFolderNameMaxLength = 50
$medialocation = 2
$conversion = ‘markdown-simple_tables-multiline_tables-grid_tables+pipe_tables’
$headerTimestampEnabled = 1
$keepspaces = 2
$keepescape = 1
$newlineCharacter = 2
$exportPdf = 1

[4] Made some minor edits the ‘ConvertOneNote2MarkDown-v2.ps1’ script from around line 918 in the script as follows:

$heading += “nID: $( $pageCfg['lastModifiedTime'].ToString('yyyyMMddHHmmss') )" $heading += "nType: #OneNote-Notebook
$heading += “nNotebookName: #$( $cfg['notebookName'] )" $heading += "nSectionName: #$( $sectionCfg[‘nameCompat’] )”
$heading += "nPageName: $( $pageCfg['nameCompat'] )" $heading += "nStatus: "
$heading += "`nTags: "

$heading += “nReferences:n ![[$( $cfg[‘notebookName’] )/docx/$( $pageCfg[‘id’] )-$( $pageCfg[‘lastModifiedTimeEpoch’] ).docx]]”
$heading += “nn—”