Public Google Calendars with C# 10

Please Share

Google calendar large

Are you trying to access a public Google calendar?   Would you like to see a list of holidays for your country, phases of the moon, week numbers, or sports events, did you know that there are public Google Calendars available with this information?    In this post we are going to look how to access public Google Calendars using a public API key created on Google Developers console.    For this post I will be using Visual Studio C# .net and the Google .net client library, I will post a similar example using the PHP client library soon.


We are going to be using a public API key in this post.  If you don’t know how to create a public API key I recommend you check my Beginning Google development post series specifically the public API key post which explains about public data vs private data and how to create a public API key on the Google Developers console.

Make sure you have enabled the Google Calendar API in your project in Google Developers console.   If you don’t know how to do that you can again check my Beginning Google development post series specifically the post about Enabling APIs which speaks about the different APIs and quotas.

Setting a calendar public

You can set one of your own calendars to public through the Google Calendar website.   When you make a calendar public, other people can:

  • Find your public calendar by searching on Google.
  • See your public calendar on a website or synced with another application.
  • Subscribe to your public calendar and view it within Google Calendar.
  • View your public calendar without using Google Calendar.
  • When you make a calendar public, you can choose to let other people see all the event details or just when you are free or busy.

How to set a Google calendar public

  1. On a computer, open Google Calendar.
  2. In the top right, click Settings settings gear button > Settings.
  3. Open the Calendars tab.
  4. Click the name of the calendar you want to share.
  5. Open the Share this Calendar tab.
  6. Check the option Make this calendar public.
  7. If don’t want other people to view the details of your events, select See only free/busy (hide details).
  8. Click Save.

Public Google Calendars

Google has a collection of Interesting Calendars they mostly contain events with regard to holidays, phases of the moon, week numbers, and sports events.   

  1. On a computer, open Google Calendar
  2. On the bottom left hand side find other calendars, click the arrow down and find browse Interesting calendars in the menu
  3. On the top you will find three tabs holidays , sports and more
  4. To add a calendar to your calendar list you can click subscribe.
  5. Go back to Google calendar the new calendar should be in the list now.

Programmatic access a public Google calendar

In order to access a public calendar you need to know its calendar ID, there is no way to search all public calendars.   The only way to find a public calendar id of one of Googles interesting calendars that I am aware of is to add it to your Google calendar.      If this is your own calendar that you have set public you could also use calendarlist.list method to get a list of all your calendars and find the ID that way.   However in my opinion its probably easier still to just check the Google Calendar website.

Find Calendar ID

  1. Click the arrow next to the new calendar, go to Settings
  2. find Calendar Address:  and the id for you calendar

List events HTTP Get

The call to list events is like most of the other calls to the Google APIs it is a simple HTTP Get, because of that we can place the following in a web browser and it will return the data to us.


You can also use Googles .net client library to see the data much easier.

C# example

From Microsoft visual studio we import the NuGet Package for the Google .Net client library

PM> Install-Package Google.Apis.Calendar.v3

Make sure you project is set to either .Net framework 4.0 or 4.5

Calendar service

Because we are using a public calendar we don’t need to authenticate the client library.    All we need to do is create a CalendarService and pass it the API key we created in Google Developers console.

 var service = new CalendarService(new BaseClientService.Initializer()
         ApiKey = "XXX",
         ApplicationName = "xyz",


Requesting data

Once we have created our CalendarService we can use it to retrieve events for the public calendar

var events = service.Events.List("").Execute();

foreach (var myEvent in events.Items)
     Console.WriteLine(string.Format("Event: {0} Start: {1} End: {2}", myEvent.Summary, myEvent.Start.DateTime.ToString(), myEvent.End.DateTime.ToString()));


Once we have created a public API key on Google Developers console it gives us access to a wealth of public data on Googles servers. One of the things that can be very useful is accessing public calendars that Google has created for us. With the standard public calendars you can find holiday information as well as other things.

Please Share

Linda Lawton

About Linda Lawton

My name is Linda Lawton I have more than 20 years experience working as a developer and a database expert. I have been working with several of the Google APIs, since 2012. I helping others in the On-Line community to develop with the Google APIs, by creating my own blog This and my presence on a number of On-Line developer forums lead me to be noticed by the Google Analytics API development team. I was nominated for and recently became one of the first Google Developer Experts for Google Analytics.

Leave a comment

Your email address will not be published. Required fields are marked *

10 thoughts on “Public Google Calendars with C#

  • Preguntón Cojonero Cabrón

    Great, very useful!

    Now, for my private calendar for my preguntoncojonero @ gmail . com account, is it possible get access programmatically to private Google Calendar?

    I have too a service account in Google Developers Console.


  • Parag Ghadge

    how to create new calendar in google calendar with c#.
    I am able to add new entry in google calendar, but it is not going into the calendar box. It showing on top of calendar.
    I have accessed google calendar through google calendar API.

  • Supreet

    This is a great tutorial. It really helped me out to get my google calendar working using the api key. Is there a way I can sort my results that are pulled from the calendar by the start date and time of the event on the calendar?

        • Supreet

          I am able to pull all the events from my google calendar for the current day. I was wondering if there is a way to display events for only the next day? I used the following code to get a list of the current day’s events.

          EventsResource.ListRequest request = service.Events.List(“public google calendar ID”);
          request.TimeMin = DateTime.Now;
          request.TimeMax = DateTime.Now.AddDays(1)
          request.SingleEvents = true;
          request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;

          Events events = request.Execute();


    Greetings Linda…!!

    I just want to ask is it possible to get all the events of google calendar and transfer into the excel file for future use..!!

    Thanks & Regards,

    • Linda Lawton
      Linda Lawton Post author

      I dont see any reason why you couldn’t do that. Events.list will return all of the events in Google Calendar so writing them to an Excel file shouldn’t be to hard.