Search code examples
google-calendar-apiicalendar

How to load google ics file for custom duration date?


I want to sync events from google calendar to save to mysql database. when I check it from google calendar it provide the ics url file and I can load it to my program. But it provide all the events. How can I get events by custom date?


Solution

  • Answer:

    Unfortunately, this is not possible to do.

    More Information:

    The ICS format is a universal calendar format designed for an easy way of sending event and scheduling data between applications.

    While it is possible to create an ICS file containing all the details of a Google Calendar, Google does not provide a way of allowing you to pick events by custom date, at least via the API.

    Workaround:

    You can use the Google Calendar API - specifically the Events: list method to get a list of events, specifying the time frame for which you wish to retrieve events, but from there you will either have to process the response in a different way (the API response comes in a JSON file as demonstrated here), or you will have to convert this data into the iCalendar format before putting it into your database.

    References: