I’m moving most of my notes from another application into Apple Notes. The current app exports notes with a hierarchal folder tree to HTML files and their inline images & attachments are stored in a top level folder. There are several ( at last 5 ) levels of directories for the exported notes.
If I point Apple Notes to the top level directory and select import, it will replicate the directory structure and import the text of the notes, but it doesn’t import the images as it doesn’t dereference the relative location of the image files. ie html file is 3 levels down, image path is “…/…/…/resources/image.png”
If I navigate to an individual html note and select import, it imports the notes and the inline images perfectly , but I have around 3000 notes in a complicated directory structure that would take days or even weeks to import one by one, manually.
I’m wonder if there is a way to import notes programmatically using Applescript. I would have the script visit each directory, import files, and then move to the next directory. That should import the note and it’s attachments correct in minutes or maybe an hour without requiring me to do anything.
Ideas? Links? I’ve done a few Web searches but I’ve only found instructions on how to import notes manually.
Convoluted idea…
Import into Devonthink (it offers a trial) then use DT’s scripting to export to Apple Notes. A quick Google search gave one example although `I am sure there are better or others out there.
What “another application”?
Also, the scriptability of Apple Notes is pretty lousy.
it looks like there really isn’t a practical solution as the DT script also only works on one file at a time, which is the problem I’m trying to solve.
I’m going to grab a cup of coffee, or two, or three , and manually navigate the directory tree, importing files as I go. I marked your post as the solution as it’s as good as any, and you put the effort into it which I appreciate!
I might even look at DNT later on as I learned there is a non-subscription version. The caveat is syncing with iDevices and being indexed for search on Mac and iDevice. From what I’ve seen DNT can export a indexable file for spotlight, but the mobile app isn’t that great.
AN checks all of the boxes for cost ( i already pay for icloud drive ) and syncing across devices.
Did you find a solution to this? I’ve written a free open-source command line tool for working with Notes, macnotesapp that can create new notes and query the notes database from the command line. It doesn’t have the capability you need off the shelf but I don’t think it would be too hard to script this (the app is written in python) and I’m willing to take a look. One limitation with attachments currently is they couldn’t be imported inline but would be at the end of the imported HTML.
1 Like
I gave up on Apple Notes. I’m using Obsidian for notes now.
As far as my Apple notes go, I was able to import them into Joplin( i may have used Bear notes as a middle man )then I exported them to markdown with FrontMatter format, and copied those into Obsidian.
Whew!