Import data from iCalendar to a real estate website


Our customer is the owner of a real estate site on Drupal for daily apartment rent, but the process of booking and scheduling management wasn’t convenient for the site owner. Not all the information about which weeks were free for each house was up to date, so the site visitors were confused about which items were already booked and which were  available and when.


Our tasks were:

  • to set up the importing of data from our client’s iCalendar account to the schedule on a site to synchronize the data
  • to set up weekly data autoimport while keeping the opportunity to manually import in any time if needed

Our challenge was to find a way to match data. All titles of apartments almost coincided with the URL-addresses in iCalendar. So we needed the houses’ IDs as well as the start and end dates of bookings from the iCalendar data.
There was no ready-made Drupal module or any other contributed solution available to be  freely downloaded and installed. Our team therefore needed to write a custom code for this unusual  purpose.


For data matching we suggested adding the new id_ical field to the node. It should contain IDs from the iCalendar. After that, the updates should begin with the help of Cron. We attach our batch (custom code) that will receive the updates based on dragged out values of houses’ IDs and IDs from iCalendar. They will update each week’s status. Then we plug in a PHP ICS Parser library to parse data from iCalendar and update the database.


As a result, we obtained a functionality that automatically updates statuses for each item (apartment) on the site based on iCalendar data. Cron runs iCalendar-migration once a week. Additionally, this data migration is able to be run manually from the admin page. So we made the process of managing the booking schedule optimized and simplified for our customer, who was satisfied with the final result that we delivered.

Get more details

Check out our Privacy Policy for more information.