Import from Apple Notes to Obsidian

Can’t really believe that my friend :frowning:


Is what you get when you Google “pandoc html to markdown”
You don’t have to have a developer mind for that…

why should I lie about this man :rofl:
Also, I needed to convert was the google takeout export so multiple files (624 notes) and typing each name in the prompt seems laborious (that’s what I mean when i say I don’t have a non-developer mind, idk how to make it automatic for a folder of files)

I have similar issue with Exporter. I have more than a thousand notes and when exported, it stops at around 250 notes (more or less) only.

As an alternative to the automator script here is my short applescript to do the same.
It saves embedded images in the same directory but still require manual tweaks afterwards to fix the links. Be also aware, there are backslashes dusting imported markdown files. They came from unmatched <\ul> HTML from notes.

It is possible to keep notes’ attachments the same way as embedded images and automate folder structure creation. This code is far from perfect but works on Big Sur OS.

Just copy-paste the collapsed code for starters. I hope that will save you some time. Cheers.

It requires pandoc tool too.

applescript code
set i to 1
set exportFolder to "/Users/<your_user>/notes_export/" # change this to your home folder location.
set pandocExecutableLocation to "/usr/local/bin/pandoc"  # brew install pandoc

tell application "Notes"
	repeat with aFolder in folders
		repeat with aNote in notes in aFolder
			set output to (body of aNote) as Unicode text
			set filePrefix to exportFolder & name of aFolder & "-"
			set targetHTMLFile to (filePrefix & i & ".html")
			set targetMDFile to (filePrefix & i & ".md")
			set myFile to open for access targetHTMLFile with write permission
			set eof of myFile to 0
			write output to myFile starting at eof
			close access myFile
			try
				do shell script pandocExecutableLocation & " --extract-media=" & exportFolder & " --to markdown --from html-native_divs-native_spans-auto_identifiers -o " & quoted form of targetMDFile & " " & quoted form of targetHTMLFile & "&& rm " & quoted form of targetHTMLFile
			end try
			set i to i + 1
		end repeat
	end repeat
end tell
1 Like

Is this for Google keep notes to obsidian?

If, like me, you have the opposite scenario with Apple Notes (migrating 1 very-large note into Obsidian instead of numerous small ones), the solution is different :

  • Create a new file in TextEdit on Mac or Notepad on Windows, in the menubar make sure the format selected is Plain Text not Rich Text
  • go back to where the notes originally are, select all, copy, paste into TextEdit or Notepad
  • then select all in there, copy, switch to Obsidian, New Note, paste without formatting (Paste and Match Style under ‘Edit’ - or Command + Option + Shift + v then select “unformatted text”. In windows, it’s Ctrl + Alt + Shift v then select "unformatted text”).

This is important because for some reason, when pasting from a non-standard multimedia featured-notes tool, markdown editors seem to parse unknown code as extra carriage-returns (blank enter-spaces), which creates a problem if you plan to do text analytics or formatting-retention is otherwise essential.

1 Like

I have a folder full of .md files. How do I import them into Obsidian?!?
New to Obsidian and still learning, so this may be somehow obvious.

1 Like

I tried bear’s script and was not happy with the results. It does not export images and only worked on 257/329 notes. It also did not report the failures.

I also tried the notes app exporter. This worked on 312/329 but similarly does not export images and dumps to txt files.

Neither bear or notes app preserves the directory structure. Bear does seem to add a tag at the end of the note indicating which project it was under in apple notes.

I found this app on the app store and it performed the best, but did not work for images. I like that it is on the app store vs write app’s being a download from their website. It exports directly to markdown and it only failed on 3 of my notes, which it reported and had an html version dumped. It also preserved my projects in the export directory structure. However, while it claims to support images, it created empty “attachments” directories with no images.

Just wanted to add this update in case it is useful to others since the two suggestions did not work best for me. Please let me know if you know of an option that works well with images.

2 Likes

Just paste the folder with all markdown into your obsidian vault directory

Today (2021-11-19) I used Version 3 of Exporter, written by Chintan Ghate. It’s much better than the AppleScript (Bear) process to extract Notes because it creates directories (folders) to mimic the structure of the Notes I created in Apple Notes. It also seems to nicely convert them to MarkDown (.md).

Buying the paid version enables me to select one or more segments inside the Notes structure, rather than the entire DB.

Exporter processed 710 notes in the time it took me to write this.
Richard.

1 Like

Sorry, I must be really dense. This is my first time using Obsidian. I have exported the notes with Exporter 3, but where is the option in Obsidian to import them??

You don’t need to import anything because Obsidian just works with local files. It simply needs to have the folder with the files accessible as, or within, a vault.

1 Like

Notice: When importing a number of .md Files and there is a folder inbetween, (In my case: Mac 10.15.7) Obsidian only imports the files that come alphabetically before the folder name. So when selecting the files imported from notes watch out that the folder called attachements or images is not selcted, it will stop the import at that point without noticing you.

Thank you very much for the solutions here. Exporter 3.0.6 works like charm for me. I exported more than 2.300 Notes. Failed Exports (I had 10) have been saved in a folder called “Failed Exports” and are converted to HTML. If I want their content in Obsidian I copy and paste it.

I used Exporter 3.1.1 without issue today on Ventura.

It’s a simple does-what-it-says-on-the-tin kind of tool. It’s free with a pro-purchase to filter note folders out from the export, but it was worth it to me to pay the nice developer that made it.

I exported several hundred notes, many of them with images in them.

Hey! Could you please share a link to this Exporter? I think I’m going down the wrong rabbit hole here when I try to find it.

Thank you

See “app” link in this post. It worked well for me.

“Copy” the .md files into the graph folder structure.
Start with one file, check the results in Obsidian, then continue

I believe that this is the best Apple Notes parser available: GitHub - threeplanetssoftware/apple_cloud_notes_parser: Parser for Apple Notes data stored on the Cloud as seen on Apple handsets

It’s an MacOS App Store app called Exporter.

1 Like

Thanks for the info. I use Exporter and it works fine for me. And there’s no need for the paid version.