August 10th, 2024

Command-Line Utility to Backup Google Mail, Calendar and Contacts to Files

The Google Backup module automates data downloads from Gmail, Contacts, and Calendar, organizing files into structured directories. Users need a Google App Password and can run backups via Node.js or Docker.

Read original articleLink Icon
Command-Line Utility to Backup Google Mail, Calendar and Contacts to Files

The Google Backup module is a tool designed to automate the downloading of data from Google services, specifically Gmail, Contacts, and Calendar. It organizes the downloaded data into a structured directory, separating files into contacts (VCF format), calendar (iCal format), and mail (EML format for both received and sent emails). The primary aim of this tool is to provide users with a reliable method to back up their data, addressing potential concerns regarding account access and data loss. To use the tool, users must first create a Google App Password through their Google account settings. The backup can be executed using Node.js or Docker. For Node.js, users can run a command that includes their Google account credentials and the desired backup file path. Alternatively, for Docker users, a similar command can be executed with environment variables set for the username, password, and file path, along with a volume mapping for backup storage. This tool offers a practical solution for users looking to ensure their important data from Google services is securely backed up.

- Google Backup automates the download of Gmail, Contacts, and Calendar data.

- The output is organized into separate directories for contacts, calendar, and mail.

- Users must create a Google App Password to use the tool.

- The backup can be run using either Node.js or Docker.

- It addresses concerns about data loss and account access.

Link Icon 6 comments
By @adrinavarro - 6 months
got-your-back uses Gmail's API instead of IMAP with an insecure app password, which is a discouraged way of accessing Gmail and will eventually be phased out in favor of OAuth access tokens over IMAP (in fact, I thought it already had been).

As for other services beyond Gmail, there's not a great ecosystem for exporting.

For one-off exports, Google Takeout is decent enough, although there's a lacking ecosystem to import the big .mbox files back to an email provider.

By @ranger_danger - 6 months
Looks handy, although it only grabbed like the first 2 years of gmail for me, out of 20. Re-running the docker image did not help.
By @xnx - 6 months
What benefit does this have vs Google Takeout?
By @kkfx - 6 months
Nice but... Backup is nothing without restore and actually "restore" for third party services on a closed proprietary infra it's not possible...

My way for mails is simply having local maildirs using mails via notmuch and serving the maildir if needed via local dovecot/with an eventual MailPile/Rainloop etc webmails, for contacts Davis (like Radicale or Baikal) with DavX⁵ on Android etc, IOW the sole way I fond is being able to use someone else service if I need it (for instance not to end up in spam on all web giants mails) but still owning my infra. Just having data I can't really use it's not enough unfortunately...

By @philipwhiuk - 6 months
Does the .eml file preserve Gmail labels? Does it handle the 'labels apply to messages not threads' problem?
By @dengolius - 6 months
I prefer an executable file to node.js garbage even if I have a Docker. Does anybody have a ready-to-use alternative that is not written on JS?