This app was a class project I wrote to meet a specific need. I am maintaining a Google Calendar of Chicago area craft beer events for publication as a list of highlighted events on my blogs. The problem was that the Google calendar had no easy way to select just the elements I needed from each calendar date array. My previous solution was to print a date range of event from Agenda view to a PDF, the copy the text into an editor, and kill a lot of lines. Taking what I have learned about APIs, I was able to use the form above that will query my Calendar for events within a certain date range, sort them chronologically, and show just the elements I wanted so I could easily copy and paste into a blog editing window.

A few notes on the building of the app:

  • GCal handles the dates for events set to “All Day” differently than for those with Start and End times, storing the time in different elements of the event’s array. I used a couple of “if” statements to work it out.
  • Since you need both a Start and End time, while I have many events for which a Start Time is given — presuming it ends when they close — I have set both the Start and End times for such events to be the same. Again, I used “If” statements to print the End Time — and the dash between — only if it’s different from the Start Time.
  • This form items above are set to input data in a DATE format instead of TEXT. In Chrome and Opera, for now, this causes the form to include a drop down calendar.

Revisions:

  • Dec. 9, '12: Fixed a search error that did not return events for the last day of the search range if they had a Start Time and it was after "00:00".
  • May 4, '13: Finally took an hour or three to figure how to put a default of "today" in the Start Date box. The default End Date is four days from today. You may change the search dates as you like.
  • Jan. 12, '18: Many little improvements in the last few years. Each location in the calendar now sports a Globe icon 🌎 that you can click for a Google map of the location. Most recently fixed so that multiple location will have their own little globe.
  • June 21, '18: Google Calendar's "update" put the editing box for events in an HTML editor instead of a text editor. I use the wonderful FoxReplace F&R utility to wrap tags around brewer names, but now it spells out the open and close for location tags as literals, as in < and >. I added to my php to substitute for the actual character so I don't have to spend so much time fixing up the event listing. Still annoyed that Google see fit to replace weblinks with redirects from google.com, but that can't be addressed for now.
  • August 30, '18: Fixed a small detail that's been bugging me, and you wouldn't notice it unless you're viewing on a smartphone. As a professional type layout guy, it bugged me that my address line was breaking up phone numbers at the end of lines. I was using FoxReplace to change all phone numbers to non-breaking hyphens, but now changes in the address line through Find & Replace don't "stick." Now I break the address line into an array, with the phone as the second element, then put it back together with a "nowrap" span, extending to the location "globe" emoji. Looks much tidier and in some browsers, the phone number highlights so you can call it.

Future improvements and wish list:

  • Of course, this needs to be able to verify the dates input to assure they are in readable date format, etc.
  • I’d like to further tidy the output by printing the date only before the first item for it. And to show only the second “pm” if both the Start and End time are after noon. Well, that will come with time. In the meantime, this puppy is functional and being used.
If you’d like me to adapt this for your own use, let me know. You basically need your Google Calendar's ID, and the Authorization code string from Google. Check out the published results on my Beeronaut Blog (Look for calendar articles)