How to register an event in Google Calendar with an icon


Hello @wezardnet. It seems that it will melt after a long day :persevere:

Around October 2017, the Google Calendar UI was revamped. Please note that the methods described in this article are valid only for the old Google Calendar.

As part of our work style reform, we are working to be able to choose from early work, late work, and normal. It seems that in the near future, it will be a flextime system.

As an internal rule, it is necessary to apply for working hours by the day before. When you apply, "Early Departure", "Late Departure", and "Normal" are automatically registered in your Google Calendar with appointments all day and shared with other employees. It is a feeling of ↓.

calendar icon_00.png

If you are stuck in the calendar every day with all day appointments, it will be very difficult for me to see the calendar if there are other appointments, and to tell you the truth, it is annoying ww

So, all you have to do is know the working hours for the day, so you can use an icon or a mark, right? That's what I thought. I thought it would be easier to see if the appointment was registered with an icon like a weather forecast calendar, so I tried it. ↓ It will be like this.

calendar icon_01.png

By the way, the weather forecast calendar is displayed like this.


If you hover the mouse cursor over the icon, it will be displayed in a speech bubble, so there is no need for a manual.

calendar icon_02.png

Let's talk about how to register.

You can't register an icon event from the Google Calendar browser UI. So register using the Google Calendar API . If you write in the Go language, you can ♪ implement it quickly

Example code

The code is omitted because it becomes difficult to see. (I didn't write exception handling, but I actually wrote :sweat_smile:it properly)

type calendar_m map[string]interface{}

// ペイロードを組み立てる
values := calendar_m {
    "start": calendar_m {
        "date": "2007-08-07", 
        "timeZone": "Asia/Tokyo", 
    "end": calendar_m {
        "date": "2007-08-07", 
        "timeZone": "Asia/Tokyo", 
    "summary": "{予定のタイトル}", 
    "gadget": calendar_m {
        "iconLink": "{予定に表示するアイコン画像の URL}", 
        "title": "{アイコンの吹き出しで表示する説明文 など}", 
payload, _ := json.MarshalIndent(values, "", "    ")

req, _ := http.NewRequest(
    "{登録先のカレンダー ID}/events", 

req.Header.Set("Authorization", "Bearer {有効な OAuth2 アクセストークン}")
req.Header.Set("Content-Type", "application/json; charset=utf-8")

resp, err := this.Client.Do(req)
if err != nil {

body, _ := ioutil.ReadAll(resp.Body)
if resp.StatusCode != http.StatusOK {

data, err := simplejson.NewJson(body)
if err != nil {

// イベント ID を入手する
id := data.Get("id").MustString()

In addition, since it is necessary to publish the icon image on the net, it is a good idea to put it in Google Cloud Storage (GCS) etc.

Sorry about

If you look at it on the mobile app, it looks like an all-day appointment . :disappointed_relieved:

calendar icon_03.png


This case was our company's initiative, but I think that it can be used to make it easier to see when you do not want to stain the calendar with a small schedule, such as a company with shift work or a morning meeting at Agile development. I think that ideas will be born if you always think about how troublesome it is or if it will be convenient if you do it this way, rather than just operating your daily routine work.


Whether this idea is adopted or not is up to the company !

Kenji Nakahara
Author by

Kenji Nakahara

Google Cloud Platform, GAE/Go, JavaScript, Google Apps Script, HTML5 触ってます。猫が大好きです。尚、投稿する記事の内容は個人の意見であり、所属する企業の見解を代表するものではありません。

Updated on January 25, 2018