Skip to main content

Scripting Evernote in Windows


This post was updated in June 2017.  Please go to that post and ignore this one.

Evernote is one of those applications with a lot more power then is immediately evident. For example, Podcast #9 debuted yesterday, and they talk about Saved Searches. As part of that, they talk about their rich search vocabulary and how they have hidden that ability in the API documentation.

Another wonderful ability not obvious until you search around on their website, is Evernote's scripting capabilities. They have one for Windows they built called ENScript, and another for the Macintosh. Of course, they have their full fledged API as well, but for a hobbyist programmer like myself, the scripting was intriguing.

I've been playing around with the scripting and thought I'd share an example script showing the kind of power it gives an Evernote user with just a little bit of programming ability.

Before we all began using Evernote, we all had data in a variety of file formats. Text files, PDF's, and Delicious bookmarks are all easy to move into Evernote. Excel spreadsheets can be moved into Evernote if you have a Premium account. What if instead of moving an entire spreadsheet, you instead want to create a note from each line of data in a spreadsheet?

Setup and Running a Test:

While I could have done this project using Excel's built in scripting tool, Visual Basic for Applications, I decided instead to use a wonderful, and free, scripting tool called Autoit. A future project I'll blog about soon couldn't be done with VBA but could be with Autoit. And after doing this project in VBA, I re-did it in Autoit and found Autoit did it more elegantly. So I will standardize on Autoit for my Evernote scripting examples I'll show here starting with this post.

Autoit is very reminiscent of my favorite rendition of Visual Basic, their 3.0.

Autoits power can be extended by users. For this project I needed the ability to link to Excel. I found that through a User Defined Function by a user calling himself Locodarwin.

Note: Links to the various files you'll need for this project are listed together at the bottom of this post.

Step 1: Download and install Autoit3.

Step 2: Download Locodarwin's Excel.Zip file

Step 3: Unzip the file to its own folder

Step 4: Copy the excel.au3 to Autoit's Include folder. If you installed Autoit3 to its default loation, the include folder is at : C:\Program Files\AutoIt3\Include

Step 5: Download this script : Excel_to_Evernote.au3. It does not matter where you install it.

Step 6: For testing, download the spreadsheet, books.xls.

Step 7: You'll need to load the script into an editor (Notepad will do) and change the line :

$sFilePath = "C:\Documents and Settings\Mark\My Documents\Evernote\excel_to_en\books.xls"

to have the path to your books.xls file.

Note: You will need Excel to run this script. I used Excel 2003, but theoretically it should work on later versions too. If it does not, please note in the comments.

Also, to keep the script fairly clean and easy to read, I really don't have any error checking in it.

Warning: This script is provided AS-IS with no warranties. I strongly urge you to copy your Evernote Database file to another location in case anything in this script were to mess you up. It shouldn't but you never know.

Step 7: In Evernote, create a notebook called "books". You can make it unsynchronized to save on your 40 or 500 meg upload quota.

Step 8: Run Autoit. It will prompt for the script file to run. Point it at "Excel_to_Evernote.au3" script. Additional script running methods are available in the Autoit Help file.

When the script runs it will start Excel with the Books.xls file in it. It will take a minute or so to run, and then give you a message box indicating it is done. The script, and Excel will then end.

Evernote needs another minute to process in the incoming information. Then you'll see this in the Books Notebook :

Modifying the script to import you own data:

You can modify the script to bring in your own spreadsheets from Excel.

Bring up the script in your own editor (like Notepad). The pertinent section is the "Information about your spreadsheet" section.

Note: text in the script after a semi-colon in the code is a comment.

Change this to the path and name of your own spreadsheet :

$sFilePath = "C:\Documents and Settings\Mark\My Documents\Evernote\excel_to_en\books.xls"

Change this to list the columns you want to move to a note. The first column becomes the title and first line. The subsequent columns become the next lines of the note :

$columns = "A,C,E"

Show the first row in the spreadsheet to list. It must have data in it

$row_start = 3

Indicate the row to stop on. The script will stop before this if it finds a blank cell in the first column chosen above.

$row_end = 15

You probably won't need to change this line if you installed Evernote in the default location:

$pathToENScript = "c:\program files\evernote\evernote3\"

The script takes the contents found in cells in the first column and makes them the title of the note. You can put in text to put before that data in the title:

$ENTitle = "James Michener Books:"

Notes will be placed in the Evernote notebook you specify here :

$ENNotebook = "books"

Each note will have the tags you list in this comma separated list :

$ENTags = "book to read,michener"

How does the script work?

Basically all this script does is walk through the spreadsheet gathering the data in the appropriate columns in a row.

Then it writes a temporary temp file with the data.

Then it invokes ENSCRIPT.exe, Evernotes script engine, to create a note from the text file, with the title and tags specified, and in the specified notebook.

Then it moves on to the next row until it reaches the first row where the first column is blank, or the last row is reached.

Concluding Notes

I realized after creating this script, and starting on the next one I'll share with you in a future post, I could have instead generated an XML file with the spreadsheet data and then imported that into Evernote. That method would require only one invocation of ENSCRIPT instead of one for each record. But it would have been less illustrative then this method.

Files you need to download:

AutoIt3 Install

Excel_to_Evernote.au3 (broken link fixed - May 2017, new version added June 2017)

Books.xls (broken link fixed - June 2017)

Be sure to comment if you have questions or would like share something about Evernote and scripting.


  1. As the author of the mentioned Excel UDF, I'm happy that you've found a good use for it. I am also an Evernote user and I like your tips!


Post a Comment

Popular posts from this blog

Recording your own notes with Google Voice

Note :   April 2016:  Frankly I don't know if this works anymore.  It is 7 years old.

I stopped using this when Google Now became useful on my phone, and I could dictate reminders using it.

I found a way a while ago to use Google Voice to record a personal note, transcribe it, and email it to me. A recent Lifehacker post "Five Things We'd Like to See in Google Voice" lists that need as their #5 request, so I realized what I'd figured out is not common knowledge.

In GV's Contacts, create a Group "Special Transcription"

To avoid listening to my standard voice mail when I call, I recorded a short voice mail greeting for this group simply saying "Record note now"

I added a contact with my own cell phone number as the only number, and made it the sole member of this group.

In GV's phone settings, I edited the settings for my cell phone. In the section "Direct access to voicemail when calling your Google number from this phone?" I se…

Your First Day with Evernote

I've written many times before about Evernote.  I love this program.  It is my brain's memory on steroids.  I have over 6000 notes in it now.  And I keep finding ever more uses for it.

While originally written in 2009, this post has been frequently updated.

New January 2012:  If you like what I write about Evernote, check out my 136 page e-book,
 "Get Productive Fast with Evernote".  Just $10.

Sunday October 11, 2009 I wrote about Evernote in my print column, Family Tech. If you are wondering what is Evernote, and why would I want to use it, start with the column.

I promised in that column this post to help new users get efficient fast with Evernote.

I thought I'd write a quick plan for someone's first day with Evernote. This is really meant for after you've installed the client to your computer, so this picks up after you've gone to  Evernote's Get Started Page and created an account and downloaded and installed a client for your primary computer.