Import “Notes” Into Evernote

February 25th, 2009  |  Published in ruby  |  24 Comments

  • Updated 12/16/2012 to add a contributed AppleScript to import notes from Mountain Lion’s to Evernote

  • Updated 5/25/2010 to add the creation date of the note to the imported Evernote item. has these things it can store called “notes.” Along with mail-based todos, they’re meant to turn into more of a productivity hub. I don’t have a strong opinion about them, mostly because they’re an absolute nightmare if you make the mistake of letting them come near a Gmail account, which I did. The experience was unpleasant enough that I never decided whether I liked them away from a Gmail account or not.

Another weird thing about Notes from a scripting perspective is that when they aren’t tied to an e-mail account, they don’t seem to exist in any way you can get at them if you store them in their little “Notes” hierarchy.’s scripting dictionary doesn’t acknowledge the existence of a specific class of things called notes, and scripts don’t find anything inside the folders holding them. AppleScripts trying to talk to the mailbox “Notes” compile but don’t do anything. appscript scripts claim that they’ve got a reference to the mailbox, but return an empty array when you ask for the items within.

Someone on the Evernote forums, however, had a good enough experience with them that he had 400 he wanted to move from into Evernote (so I guess the experience wasn’t that great in the end). Like I said, I don’t even care about notes, but I did think “I’ve already done that with messages in Evernote, so I’m sure I can easily repurpose that.” That’s when I discovered the existenceless existence of Notes.

It turns out, though, that you can just make a new mailbox on your Mac and drag all your notes into it, at which point they become messages for purposes of scripting them. The first line of the note is the “message” “subject,” and every line of the note including the first is the “message” “content.”

Once I had that worked out, it was easy to mass import a sample of test notes into Evernote:

I ended up deciding to do it in Applescript when I realized Ruby probably would not be helpful to the original poster. If you count the shebang and require lines, it took 18 more characters in Ruby than in AppleScript.

Here’s another one, contributed in the comments by Lee, for using the new found in Mountain Lion:


  1. Justin says:

    April 22nd, 2009 at 10:25 pm (#)

    Hi Mike,

    Your script inspired me to make a “Apple Mail to Evernote AppleScript” of my own:

    Kind Regards, Justin

  2. Fletcher Tomatly says:

    October 24th, 2009 at 9:30 pm (#)

    Worked perfectly, thanks so much!

  3. trav says:

    November 2nd, 2009 at 4:13 pm (#)

    this is fantastic thanks!!!

  4. Sergio says:

    December 13th, 2009 at 2:39 pm (#)

    Thank you!

  5. Orlando says:

    December 19th, 2009 at 2:26 pm (#)

    Would it possible to add a step by step of this process for people who never wrote an applescript before? Thanks.

  6. Christopher John Shaker says:

    November 2nd, 2010 at 4:10 pm (#)

    Worked great for me, except that it created some very long note titles. This broke Evernote, it would not sync. Gave me ‘Evernote Multiple validation errors occured.’ I selected all of my notes and then exported them to an Evernote file before I exited the program. Good thing I did, because only three of my notes made it to the Evernote server.

    The longest title Evernote supports is 255 characters long. The program isn’t smart enough to check it and warn you about it! Some of my titles were one paragraph long!

    Once I edited the note titles and trimmed them down to size, Evernote synced my messages just fine.

    Help for those who’ve never run an Apple Script before:

    o Create a new mail folder called “NoteMigrate” o Select and copy all of your Mac Notes. Paste them into ‘NoteMigrate’ o Go into Applications/Utilities o Open the ‘AppleScript Editor’ o Copy and paste the apple script above into the top window o Click ‘Run’

    That did it for me. Chris Shaker

  7. Søren says:

    November 28th, 2010 at 3:49 am (#)

    Thanks – worked like a charm, very easy and elegant. Saved me a ton of work.

  8. Juan says:

    February 22nd, 2011 at 2:06 pm (#)

    Thank you, it works perfect!

  9. Rachael says:

    November 29th, 2011 at 3:02 am (#)

    worked first time round and was worth all the research made to find it

  10. Andy Bilodeau says:

    July 8th, 2012 at 7:16 am (#)

    Even 3 years later, this applescript worked flawlessly. woo hoo. thanks for posting this!

  11. Lee says:

    July 28th, 2012 at 12:03 am (#)

    Pretty cool; thanks. Updated for new Notes app in Mountain Lion:

    tell application “Notes” set theNotes to every note of the folder “Notes”

    repeat with thisNote in theNotes
        set myTitle to the name of thisNote
        set myText to the body of thisNote
        set myCreateDate to the creation date of thisNote

    tell application "Evernote"
        create note with html myText ¬
            title myTitle ¬
            created myCreateDate ¬
            notebook "Imported Notes"
    end tell

    end repeat

    end tell

  12. m. hall says:

    July 28th, 2012 at 2:21 am (#)

    Thanks, Lee! I’m going to put that in a Gist and embed it above, if you don’t mind.

  13. Alex S says:

    February 4th, 2013 at 1:23 pm (#)

    Thank you very much! You just made my day!

  14. Dave says:

    February 6th, 2013 at 12:53 pm (#)

    Anybody monitoring this still? I am getting an error and would like some help with the ML script. Here is the error:

    An internal database error has occurred that prevents Evernote from functioning properly. If the problem persists, please contact Evernote Support.

    I am using it exactly like it is posted above.



  15. m. hall says:

    February 6th, 2013 at 2:28 pm (#)

    Hey, Dave,

    I still live here, so I guess it’s monitored. :-)

    Which version of the script is throwing this error? The AppleScript version that uses Mail notes, the Ruby version, or the AppleScript version that uses the Notes app?

  16. zhubochubo says:

    February 18th, 2013 at 8:13 pm (#)

    Hi m.Hall: thankyou for this great script. I know what the cause of Dave’s problem is, because it’s the same with me — evernote doesn’t like titles longer than 255 characters. I wonder, is there a way to modify the “set myTitle to the subject of thisMessage” line so that the title is set to be only the first 255 characters of the “subject of thisMessage”?

    If not, Dave, one way around it is to flick through your notes and add a break when the first line is really long. However, this does have the disadvantage of changing the “Date Received”, and therefore the “Created” field in Evernote, to today’s date.

  17. zhubochubo says:

    March 4th, 2013 at 9:13 am (#)

    no ideas on this?

  18. Sowenjub says:

    March 11th, 2013 at 3:47 pm (#)

    4 years later and it’s still useful, thanks a lot :) I forked your gist and added export of the modification date as well

  19. David Payette says:

    April 9th, 2013 at 7:17 am (#)

    Really, really helpful. Thanks.

  20. Nello sacco says:

    May 20th, 2013 at 4:07 am (#)

    From Bologna Italy A great great great thank you

  21. Bill DAlessandro says:

    June 17th, 2013 at 1:12 pm (#)

    Here’s an improvement to the AppleScript that handles titles longer than 255 characters:

    tell application “Notes”

    set theNotes to every note of the folder "Notes"

    repeat with thisNote in theNotes

    set myTitle to the name of thisNote

    if length of myTitle is less than 255 then

    set myShortTitle to myTitle


    set myShortTitle to text 1 thru 254 of myTitle

    end if

    set myText to the body of thisNote

    set myCreateDate to the creation date of thisNote

    set myUpdateDate to the modification date of thisNote

    tell application "Evernote"

    set theTransferredNote to create note with html myText ¬
        title myShortTitle ¬
        created myCreateDate ¬
        notebook "Notes"
    set modification date of theTransferredNote to myUpdateDate

    end tell

    end repeat

    end tell

  22. Bill DAlessandro says:

    June 17th, 2013 at 1:13 pm (#)

    Hey there – just letting you know I posted an update further down the page that correctly handles notes longer than 255 characters…

  23. William P. Riley-Land says:

    July 9th, 2013 at 10:23 am (#)

    The AppleScript helped a lot, but would crash Evernote when trying to create specific messages. I had to copy those manually, then delete them for it to work, but much much better than c&p each by hand.

  24. William P. Riley-Land says:

    July 9th, 2013 at 10:25 am (#)

    Ah, that was probably my issue. Should have scrolled down!

Leave a Response

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.