Screenshot of Google Keep, with some blurred out note cards of various colors.

In this article, we’ll look at some options to help backup/archive Google Keep notes, including a solution I built, called Archiver for Google Keep. I built this tool because I wanted an easy way to back up my Google Keep notes in an automated manner, and existing solutions out there weren’t able to meet the need I have. While Google gives us Google Takeout, an enterprise level Google Keep API, and then there is the unofficial gkeepapi by Kiwiz and built in Python, none of these solutions were able to do what I needed.

Why existing solutions don’t work

First, the enterprise level API still isn’t well documented. There are no simple examples on how to create or save a note, not like with the unofficial API. Also, there is no official client library from Google yet. I also didn’t get time to dig into that API, mostly because wasn’t sure it would work with a non Google Workspace email address.

Another option is the unofficial gkeepapi, written in Python. I did spend some time working with it, but in May of 2022, Google made a change that prevents accounts from using app passwords. App passwords were a feature of Google which allowed non Google third party apps to login to Google on your behalf. Instead of using your regular login and password, Google generated a token, roughly 16 characters, which you use, in place of your password, to allow these apps to authenticate your Google account.

The third option, Google Takeout, doesn’t do automation, and the enterprise API sounded like it wouldn’t solve my problem since not every account is an enterprise account. I still haven’t tried it. Maybe it will work.

The gkeepapi was the most promising, until app passwords stopped working. Google continues to increase security of their platform, which is good, but it has gone to absurd, ridiculous levels, which render some functionality useless. Here is what happened with my gkeepapi experiment:

I wrote a small Python script on GitHub Actions that would run once a week and scrape all of my Google Keep notes, zip them up, and then upload them to a Backblaze B2 bucket. I wanted to automate the backup so I don’t have to think about it.

I added the app password as a repository secret, and I ran the workflow. A few seconds later, I got red security warnings on my computer and my phone saying my account has been compromised and someone is using my password.

Now, some services will ask you to verify if they suspect a security breach. For instance, when my bank sees a charge it thinks looks suspicious, I call the bank and tell them that, yes, it was me, and they allow the transaction to go through.

I seem to recall Google does this in some cases, but Google has no facility for telling its security alert system that there is no issue in this situation, and I was forced to change my passwords to make the red security warnings go away. I kept thinking, “What idiots! I am the person using my password. It’s me, you idiots! The person trying to use my password is me!” But there was nothing I could do.

The person who developed the unofficial gkeepapi, Kiwiz, put a lot of great effort into reverse engineering an API. Unfortunately, I cannot use it. It’s not Kiwiz’s fault though. These issues are tough to overcome when you’re building on top of a large company’s platform, like Google, who has their own agenda, which doesn’t involve your interests.

Why backup Google Keep notes

Now, you might be wondering, why do I want to backup Google Keep notes. They’re already in the cloud, and Google backs up their stuff. While this is true, again, Google only does these things to support their own agenda. They’re not backing that data up for us, they’re doing it for themselves. If my phone comes alive in my pocket, manages to do something akin to pocket dialing, except instead opens Google Keep and starts pocket deleting notes, there is little I can do to get that data back.

People lose data in the cloud all the time, maybe not due to pocket deleting but oftentimes due to human error. I might delete a card by accident, or edit something incorrectly and lose critical data.

What’s more, companies have been known to shut down and delete customer data if they feel the user violated some terms and conditions. Sometimes this happens to people through no fault of their own. Our data is not under our control, and vendors like Google can remove it from their systems, or remove our access to that data, and there isn’t much we can do, unless we have our own copy of that data.

Moreover, sometimes cloud storage companies get in trouble with the government, and as part of an investigation, the government seizes their servers. Your data sits in some FBI office until investigations are complete, and still those servers may never come online again. This happened to users of Megaupload before the FBI shut them down. Some of the users were business users who stored legitimate business data on Megaupload’s servers. It was simply too costly for the FBI to maintain the data, so it all got destroyed, with the exception of maybe a handful of customers, armed with their lawyers, who were incredibly persistent with their demands.

So with these scenarios in mind, if I back up my data to a third party system, like Backblaze B2, as well as at least two other places, then if one of the above scenarios occur, my data is protected. This is important to me, and here is why.

Commonplace Books

For the last several years, I have literally used Google Keep for everything. I keep travel checklists in it, notes about various projects I work on, project ideas, notes from listening to podcasts and reading articles, and a code snippets reference, which helps me do the same thing again faster, since I can simply lookup the code samples using Google’s powerful search. I also keep configuration information about virtual machines I use regularly, so I know which one has various tools installed. I also keep inspirational quotes in Google Keep. Basically, Google Keep is like my bullet journal or pocket journal. It’s what Ryan Holiday might call a “Commonplace Book”.

I got inspired to start keeping all of my notes in Google Keep after reading Ryan Holiday’s post, How And Why To Keep A Commonplace Book. Commonplace books are gold. They’re a place for you to record thoughts and ideas that you may need to recall later on. Our brains are bad at storing ideas, so having a place to offload them makes room for our brains to do what it does best, which is to create.

To stay organized, I created a system of labels for different types of notes, and each label has a pinned note that describes what the label is for and what kinds of notes should and shouldn’t be assigned that label. This helps me stay organized and remember what each label is used for.

archiver-for-google-keep - Manually triggered, automated backups of Google Keep

So the question remains: What am I doing to meet the goal of automating backups? Well, at work, I’ve used WebdriverIO. I’ve been helping our QA engineers with their coding skills for the past couple years. I’ve helped develop more reliable test automation strategies, and along the way learned some very valuable things myself. While most people seem to be using WebdriverIO to test websites and web applications, I used it to scrape content from all my Google Keep cards. I then wrote functions that write that data to Markdown and JSON files. This bypasses the need for app passwords, since I login directly through the browser.

The way this works is you run keep-archiver from the terminal. This launches Chrome (or Chromium if you’re on ARM Linux). If you’ve logged into Google Keep previously, then the browser opens directly to the Google Keep web app. Otherwise, you encounter a login page. At this point, you login once with your login and password. Once on the Google Keep site, click any label you would like to backup. Alternatively, just leave the home page loaded to backup everything. To start with, I recommend backing up specific labels since this is still experimental.

After running keep-archiver, in the terminal, you will be prompted to start the backup. Press enter when Google Keep is fully loaded.

 ATTENTION: Please follow these steps to export/backup your data
  1. Login to Google Keep
  2. Click on the label you wish to backup.
  3. Press ENTER to start the backup (or press ‘q’ to quit).

prompt: Continue with the backup? (Press ENTER):

Now comes the fun part. WebdriverIO will automatically scroll all of the notes into the view. Depending on how many you have, this may take some time. Once the notes are all loaded, WebdriverIO then clicks through each note individually and grabs all of the data from each note.

Once this process is done, the application writes out each note to the filesystem, with the files having the last edited time as the timestamp. This makes it easy to sort your exported notes from oldest to newest. Currently, the data is exported to both Markdown files and JSON files. There is a framework in place for adding additional generators to write content to other file types, should someone want to contribute.

At this point, I’ll be uploading my archived notes to Backblaze and a hard drive, but you can do a number of things with your notes at this point. For instance, you can import them into another tool, such as GitJournal, an open source alternate to Google Keep, which stores notes in GitHub. You could also use a static site generator, such as Hugo or Gatsby, to publish your Markdown notes as a blog or website.

I haven’t yet tried Archiver for Google Keep on GitHub Actions. Something tells me it won’t function properly due to Google’s security, but I can still use cron on macOS to automate the backup. More research and work needs to be done to fully realize a complete, automated solution. See the roadmap if you are interested in contributing.

If you just want to use the application, you can install it from the NPM package repository. See the archiver-for-google-keep repo for more details.