How to backup your Google Calendar automatically on a Windows machine

This is a quick and brief example of how to schedule a backup of a Google Calendar on a Windows machine. This technique uses a PowerShell script and the Windows Scheduler.

First you need to get the information required from Google:

  1. Login to Google Calendar.
  2. Under “My Calendars” click the down arrow (outlined in red in the pic below) that’s at the right of the name of your main calendar, the one you want to backup.

Google Calendar Settings

  1. Then click “Calendar settings”.
  2. In the view that appears, scroll down to the bottom, and find the bit headed “Private Address”, see below.

Google Calendar Right Click Position

  1. Right click the green ICAL button under “Private Address”, which provides the URL or web address of your own calendar file which will be something like https://www.google.com/calendar/ical/ThisIsMadeUp.calendar.google.com/private-1666abcdefa52b25e9539a043a0813cd/Calendar.ics (NOTE: keep this address to yourself).

Next create a PowerShell script:

The following should be saved in a file (this will use the example file C:\GoogleCalendarBackup.ps1) where the $Source is set to the “Private Address” URL retreived above:

$WebClient = New-Object System.Net.WebClient
$source = "https://www.google.com/calendar/ical/ThisIsMadeUp.calendar.google.com/private-1666abcdefa52b25e9539a043a0813cd/Calendar.ics"
$target = "C:\GoogleCalendarBackup.ics"
$WebClient.DownloadFile($source, $target)

Finally create the scheduled task:

  1. Open Start Menu\All Programs\Accesssories\System Tools\Task Scheduler
  2. Select Action\Create Basic Task…
  3. Enter a name and (optionally) a description then press Next.
  4. Select the frequency of the backup and press Next.
  5. Select the details of the backup frequency and press Next.
  6. Select “Start a program” for the Action and press Next.
  7. Browse to the PowerShell executable on your machine e.g. C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.
  8. Put -nologo -command “& {C:\GoogleCalendarBackup.ps1}” in the Add Arguments box and click Next.
  9. Review your setting and click Finish.

I ran the scheduled task to ensure that the backup worked then checked that the scheduled task is running for the first few times just to be sure.

NOTE: Retrieving the Google Calendar URL is based upon http://www.consumingexperience.com/2010/04/how-to-backup-your-google-calendar.html by Improbulus

Many thanks to Improbulus.

Advertisements