Created
June 26, 2012 02:42
-
-
Save robertpateii/2992931 to your computer and use it in GitHub Desktop.
import into evernote from excel spreadsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Sub OutputNotesXML() | |
Dim iRow As Long | |
Close #1 | |
With ActiveSheet | |
'For iRow = 2 To 2 | |
Open ThisWorkbook.Path & "\evernote-import.enex" For Output As #1 | |
Print #1, "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "UTF-8" & Chr(34) & "?>" | |
Print #1, "<!DOCTYPE en-export SYSTEM " & Chr(34) & "http://xml.evernote.com/pub/evernote-export.dtd" & Chr(34) & ">" | |
Print #1, "<en-export export-date=" & Chr(34) & "20120202T073208Z" & Chr(34) & " application=" & Chr(34) & "Evernote/Windows" & Chr(34) & " version=" & Chr(34) & "4.x" & Chr(34) & ">" | |
For iRow = 2 To .Cells(.Rows.Count, "A").End(xlUp).Row | |
Print #1, "<note><title>" | |
Print #1, .Cells(iRow, "A").Value 'Title | |
Print #1, "</title><content><![CDATA[<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "UTF-8" & Chr(34) & "?>" | |
Print #1, "<!DOCTYPE en-note SYSTEM " & Chr(34) & "http://xml.evernote.com/pub/enml2.dtd" & Chr(34) & ">" | |
Print #1, "<en-note style=" & Chr(34) & "word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" & Chr(34) & ">" | |
Print #1, CBr(.Cells(iRow, "B").Value) 'Note | |
Print #1, "</en-note>]]></content><created>" | |
Print #1, .Cells(iRow, "D").Text 'Created Date in Evernote Time Format... | |
'To get the evernote time, first convert your time to Zulu/UTC time. | |
'Put this formula in Column D: =C2+TIME(6,0,0) where 6 is the hours UTC is ahead of you. | |
'Then right click on your date column, select format, then select custom. Use this custom code: yyyymmddThhmmssZ | |
Print #1, "</created><updated>201206025T000001Z</updated></note>" | |
Next iRow | |
Print #1, "</en-export>" | |
Close #1 | |
End With | |
End Sub | |
Function CBr(val) As String | |
'parse hard breaks into to HTML breaks | |
CBr = Replace(val, Chr(13), "") | |
CBr = Replace(CBr, "&", "&") | |
End Function | |
'I modified this code from Marty Zigman's post here: http://blog.prolecto.com/2012/01/31/importing-excel-data-into-evernote-without-a-premium-account/ | |
'Download this as an excel file with example data: https://dl.dropbox.com/u/6237857/Evernote%20Import%20Macro.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on your work I've created another macro, which can read Evernote files into Excel worksheet. Here it is: https://gist.github.com/md2z34/4748871