Exporting Chrome and Google Bookmarks to Evernote

Recently I started revisiting the way my data was spread across different cloud services. Up until now, I’ve been using Google Bookmarks to keep all my bookmarks, lots and lots of them, using mainly tags to keep organized. A few years ago when I decided to move from Delicious, it felt like an obvious choice. A few hiccups along the way, but so far, it worked really well. I even created a Chrome extension to help bookmarking and searching  bookmarks from the omnibar. A few things annoyed me, like presenting tags the same way as folders, all listed on the left sidebar, creating a loooong page with only links on the side.

Lately I also started bookmarking a few links on Evernote, specially references to technical articles and so on. In the spirit of simplifying, I decided to consolidate everything in the same place, Evernote. This meant I would have to migrate my 3k+ bookmarks from Google to Evernote, trying to preserve all tags and possibly creation dates.

Google Bookmarks doesn’t provide a huge list of exporting options, only one HTML format, with links grouped by tag. The interesting thing about the format is that bookmarks are duplicated if they have more than one tag. One annoying thing I would have to deal with.

Looked around for services or scripts that could help migrating, but not much luck. Most guides only suggested importing the HTML file directly to Evernote, creating one singe note, and that’s not what I wanted. Looked a little bit further and found a Python script on GitHub. Very simplistic. The script would parse the file and write the output in an Evernote format, or ENEX, a simple XML file with Evernote tags.

Tried it and it worked, at least it ran and created a new file. Tried to import it on Evernote and no luck. It failed giving no clue about what was wrong. I decided to play with the file a little bit and found the problem, a few spaces and empty lines in the wrong place. Fixed the script and import worked, sort of…

Remember I mentioned about duplicate entries on the exported file. The script did not account for that, so all entries with more than one tag were duplicated.  That would not work. Since the script was almost done, I just decided to fork it and fix this small things. Included a check for duplicated bookmarks. While I was at it, I also minified the output and included created dates to the exported fields.

If you are looking for something similar, the script is on GitHub…

https://github.com/spiermar/bookmarks2evernote

Use it, fork it, improve it. And let me know what you think! ;-)

Tweet about this on TwitterShare on LinkedInShare on FacebookShare on Google+

21 thoughts on “Exporting Chrome and Google Bookmarks to Evernote

  1. thank you man…
    exactly what I was looking for…

  2. I’m also having issues running the script – different than the others mentioned here. I’m on a macbook pro with mountain lion, python 2.7.2, and as far as I can tell, beautiful soup has been installed, but when I try to run the script, I get the following output (also showing the attempted install of beautiful soup that seems to look like it’s already installed):

    coeadmins-MacBook-Pro:Downloads $ pip install beautifulsoup4
    Requirement already satisfied (use –upgrade to upgrade): beautifulsoup4 in /usr/local/lib/python2.7/site-packages
    Cleaning up…
    coeadmins-MacBook-Pro:Downloads $ python bm2evernote.py GoogleBookmarks.html
    Traceback (most recent call last):
    File “bm2evernote.py”, line 1, in
    from bs4 import BeautifulSoup
    ImportError: No module named bs4

    • Nevermind, figured it out. Evidently beautiful soup wasn’t actually installed – I was able to install it using easy_install via ‘sudo easy_install beautifulsoup4’. After that, running the script worked great. Thanks for posting it!

      • Actually, it turns out I still do have an issue. :-/ When I import the .enex file into evernote, the tags do not come across properly. They appear to be in the exported xml, however – ex:

        AS3 E4X Rundown | dispatchEvent() Blog™
        &lt;![CDATA[<a href="http://dispatchevent.org/roger/as3-e4x-rundown/" rel="nofollow">AS3 E4X Rundown | dispatchEvent() Blog™</a>]]&gt;
        20110210T012908Z
        20110210T012908Z
        ActionScript
        Programming

        http://dispatchevent.org/roger/as3-e4x-rundown/

        Any idea why the tags do not show up? Did evernote’s .enex format change since you wrote this script? This appears to not be the case since the dtd for the note format has this entry:


        Looks like your export format is correct…not sure what else to try here. :-/

      • Interesting. I managed to import tags, but that was a while ago. Maybe they changed the format. I need to check it again. I’ll let you know if it works here or not. Similar system, Macbook Pro, but running Mavericks.

      • Wow, that’s some rather unfortunate formatting. Try this for the exported xml example:

        https://gist.github.com/AZ2Tonez/e09d055abec73b564c32

        and this for the applicable dtd:

        https://gist.github.com/AZ2Tonez/67bcef88ae24b9a2066f

      • I know, it’s horrible to read. Never worried too much about it since it was just for importing, but I think its a good thing to “prettify” the output, specially for troubleshooting. Can you create an issue on GitHub?

      • I believe the issue is on the evernote side. I was able to import some different bookmarks exported from your script and get tags. I was thinking maybe it was something to do with the tag(s) already existing in my evernote db because the ones that worked had new tags that did not exist in any of my notes yet. I tried to reproduce the issue by removing all of the new/working notes and re-import after deleting the new tags they had created and that didn’t work. So, if the tags being imported have ever existed in your db at some point (whether they do now or not), they don’t seem to show up – and again, that sounds like an evernote problem to me. Most people probably don’t see it because they import into a fresh db that has never had notes/tags in it, so it all just works.

        BTW, my “unfortunate formatting” comment was in reference to the way this web page formatted the xml I was trying to post (i.e. pink/bold with a bunch of missing tags, etc.), not the text that your tool spat out. :)

      • Fair enough! True, code formatting on this theme is not great. That’s why I use Github Gists so much! ;-)

  3. Hi there.
    I’m a python newbie. I installed Active State Active Python and Beautifulsoup.
    when i launch a “python bm2evernote.py chrome.html” i always get the following error :

    File “bm2evernote.py”, line 59
    print “Total Bookmarks: “+ str(len(bookmarks))

    SyntaxError: invalid syntax

    Am i doing anything wrong ? Thanks !

  4. Hi, thanks for this – it’s exactly what I need.

    Unfortunately I cant get it to work, I get the following error message when I try to import the .enex file into Evernote:

    Could not import notes, error: MISSING_NOTE_TITLE

    Any ideas?

  5. Got here because have tthe same prob of multiple spaces (evernote, gbookmarks, onenote, diigo) and had the same idea of putting every note and bookmark in evernote. I use chrome and ff. The prob is that doing that we loose omnibox search
    JPaz

  6. Hi again! :)

    In this fork, I added support for Google Bookmarks’ notes:
    https://github.com/igorrs/bookmarks2evernote
    (It’s also using html.parser)

    I have notes in most of my Google bookmarks. ;-)
    Well… guess it’s perfect for me now. I hope other guys keep forking and improving. :)

    Once more, thank you!

  7. Hi there. Thanks for the code!

    The program as it came was not able to find all the h3/a tags in my exported Google Bookmarks file.
    However, switching the parser to html.parser worked for me:

    soup = BeautifulSoup(codecs.open(args.html_file, encoding=’utf-8′), ‘html.parser’)

  8. None of these have instructions…how do I use this and https://github.com/kerchen/export_gr2evernote ? I have python installed.

    • That’s a good point. It might be interesting to include usage instructions to README.
      Overall usage is pretty simple. If you have Python installed, you only have to install the dependencies, in this case, Beautiful Soup (http://www.crummy.com/software/BeautifulSoup/). They have install instruction on their site, but it should be as simple as:

      pip install beautifulsoup4 or easy_install beautifulsoup4

      After that you should be able to execute the script:

      python bm2evernote.py .html

      Just one note, I'm assuming you already exported your bookmarks from Chrome or Google Bookmarks in HTML format. Also, that you downloaded or cloned the script from GitHub.

      -Martin

Leave a Reply