Get List of Holidays Using Google Calendar API

To Get List of Holidays Using Google Calendar API, here are 2 major steps to follow,

Below you can check complete source code to get public holidays and live view also.

Set-up Google Calendar API on Google Developer Console

Here is complete step by step process to Set-up Google Calendar API on Google Developer Console first,

Go to https://console.developers.google.com/ then click on “New Project”. You can also check this link to get complete action to get credentials. Here https://codingtasks.net/login-with-google-account-using-php-step-by-step/#Steps_to_Create_Google_API_credentials

Create Project on Google Console
Create Project on Google Console

Now we enable the Google Calendar API by using a search box. Search for Google Calendar API and click on it.

Click the highlighted and you see the page for enabling calendar API,

Enable Google Calendar API
Enable Google Calendar API

Now we create an API key by clicking on “Create Credentials”.

Create API key On Google Console
Create API key On Google Console

After complete the creation of Google Calendar API we use the API Endpoint to get the holiday data.

Here is the complete source code to get the list of holidays.

Code Highlights:

  • On the API endpoint, we pass the country values dynamically.
  • And all the country values are defined on the google calendar API docs.
  • Here we use jQuery to get the JSON data from API and take only mandatory fields.
  • On API two main fields are we show “summary” which shows holiday name and “start date”.

Live View of Get List of Holidays Using Google Calendar API

See the Pen Get List of Holidays Using Google Calendar API by Bikash Panda (@phpcodertech) on CodePen.

This is a complete tutorial, which shows How to get holidays using JavaScript. You can also use this API for other languages.

Also Check:

Happy Coding..!

Was this article helpful?
YesNo

By Bikash

My name is Bikash Kr. Panda. I own and operate PHPCODER.TECH. I am a web Programmer by profession and working on more than 50 projects to date. Currently I am working on the web-based project and all the CMS and frameworks which are based on PHP.

11 thoughts on “Get List of Holidays Using Google Calendar API”
  1. Hi,
    Thanks for the helpful post. What if I want to retrieve the holidays of previous or next years rather than the default years? Suppose I want to get the holidays of 2018 or 2019 or 2023?

Leave a Reply

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