Skip to content

Instantly share code, notes, and snippets.

@vedant
Last active September 26, 2024 01:23
Show Gist options
  • Save vedant/9333992 to your computer and use it in GitHub Desktop.
Save vedant/9333992 to your computer and use it in GitHub Desktop.
Export note files from Google Keep
/* Vedant Misra (vedantmisra.com) (github.com/vedant)
*
* Script for exporting Google Keep note files.
*
* This does not handle attachments or checklists, only note files. Downloads
* each note to a .txt file named for the note's title.
*
* To use this, go to https://drive.google.com/keep/ and wait for the page to
* fully load all of your saved notes; scroll to the bottom to confirm they're
* loaded. Then paste the below in your URI bar, go to the start of the line,
* prepend what you pasted with "javascript:" without quote marks, and hit enter.
*
* REVISED for Google Keep update. 2014-09-14
*/
(function(){"use strict";var e=document.createElement("SCRIPT");e.src="//code.jquery.com/jquery-latest.min.js";e.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(e);var t=function(e){if(window.jQuery){e(jQuery)}else{window.setTimeout(function(){t(e)},100)}};t(function(e){(function(e){e.save=function(t,n){if(!t){e.error("Console.save: No data");return}if(!n){n="console.txt"}if(typeof t==="object"){t=JSON.stringify(t,undefined,4)}var r=new Blob([t],{type:"text/text"}),i=document.createEvent("MouseEvents"),s=document.createElement("a");s.download=n;s.href=window.URL.createObjectURL(r);s.dataset.downloadurl=["text/text",s.download,s.href].join(":");i.initMouseEvent("click",true,false,window,0,0,0,0,0,false,false,false,false,0,null);s.dispatchEvent(i)}})(console);var t=e(".IZ65Hb-YPqjbf.h1U9Be-YPqjbf"),n=e(".IZ65Hb-YPqjbf.r4nke-YPqjbf");for(var r=1;r<=t.length;r++){t[r].click();var i=e('.IZ65Hb-YPqjbf.h1U9Be-YPqjbf[contenteditable="true"');console.save(i[1].innerText,n[r].innerHTML+".txt")}alert(t.length-1+" files downloaded.")})})()
@forkwhilefork
Copy link

yeah, this isn't working for me exactly. it downloads one of my notes and names it the title of a different note. seems to be close though.

@mayurjobanputra
Copy link

Doesn't work for me. Says Error 400

@einichi
Copy link

einichi commented Dec 5, 2019

Quickly hacked this together since this script no longer seems to work:

https://gist.github.com/einichi/17ef170854438371b1265ce83d18a1b6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment