{"id":190,"date":"2022-04-11T20:41:51","date_gmt":"2022-04-11T20:41:51","guid":{"rendered":"http:\/\/duff.io\/?p=190"},"modified":"2022-04-11T20:41:51","modified_gmt":"2022-04-11T20:41:51","slug":"gam-google-sheets-calendars","status":"publish","type":"post","link":"https:\/\/duff.io\/?p=190","title":{"rendered":"GAM, Google Sheets &#038; Calendars"},"content":{"rendered":"\n<p>While web interfaces make things easier, it is often much faster to do things on the command line, especially if you are trying to make changes in bulk.&nbsp;<\/p>\n\n\n\n<p>My school recently added Google Calendars for all our sports teams. One trick to make this easier is to use Google Sheets (or Excel) to convert spreadsheet data into commands I can paste into the terminal window of my Mac.\u00a0<\/p>\n\n\n\n<p>I use <a href=\"https:\/\/github.com\/taers232c\/GAMADV-XTD3\">GAM-ADV-XTD3<\/a> (a more advanced version of GAM) that uses the <a href=\"https:\/\/developers.google.com\/admin-sdk\">Google Admin APIs<\/a> to mange my Google Workspace environment from the command line.<\/p>\n\n\n\n<p>In GAM-ADV-XTD3 you can create a calendar in a user account like so:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">gam user <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">athletics-calendars<\/mark><\/strong> create calendar summary \"<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">Sailing - Varsity<\/mark><\/strong>\"<\/pre>\n\n\n\n<p>In the example <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\"><code>athletics-calendars<\/code><\/mark><\/strong> is the username of account I wish to create the account in and <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\"><code>Sailing - Varsity<\/code><\/mark><\/strong> is the calendar name. <\/p>\n\n\n\n<p>If I have a Google sheet with a list of sports I need to create a calendars for, I can simply write a formula (like the one below) to generate the commands to create all those calendars. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">=\" gam user athletics-calendars create calendar summary \"\"\" &amp; <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">A1<\/mark><\/strong> &amp;\"\"\"\"<\/pre>\n\n\n\n<p>This combines the text of the command with the contents of the cell <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\"><code>A1<\/code><\/mark><\/strong> (which is where the sports team&#8217;s name is). To quote a quote is a little tricky but the formula above works. I then fill down for all the sports teams and now I have the commands to create all of the calendars. I can highlight all of the cells with these commands (<code>B1:B17<\/code> in the example below) and paste them into terminal to run them.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"943\" height=\"782\" src=\"https:\/\/45-79-134-51.ip.linodeusercontent.com\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-11-at-2.11.34-PM.png\" alt=\"\" class=\"wp-image-192\" srcset=\"https:\/\/duff.io\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-11-at-2.11.34-PM.png 943w, https:\/\/duff.io\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-11-at-2.11.34-PM-300x249.png 300w, https:\/\/duff.io\/wp-content\/uploads\/2022\/04\/Screen-Shot-2022-04-11-at-2.11.34-PM-768x637.png 768w\" sizes=\"auto, (max-width: 943px) 100vw, 943px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>After a few seconds I now have 17 calendars created!<\/p>\n\n\n\n<p>Some other handy e <a href=\"https:\/\/github.com\/taers232c\/GAMADV-XTD3\">GAM-ADV-XTD3<\/a> calendar related commands: <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Give a user access\/permission to a calendar:<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gam calendar <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">xyzzyasfda@group.calendar.google.com<\/mark><\/strong> add acls <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">writer<\/mark><\/strong> <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-yellow-color\">user@exampledomain.com<\/mark><\/strong><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\"><code>xyzzyasfda@group.calendar.google.com<\/code><\/mark><\/strong> is the Calendar ID that you want to give access to <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-yellow-color\"><code>user@exampledomain.com<\/code><\/mark><\/strong>. While <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\"><code>writer<\/code><\/mark><\/strong> allows someone to edit a calendar, you need to assign <strong><code>owner<\/code><\/strong> in order for them to change sharing settings.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Make a calendar public:<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gam calendar <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">xyzzyasfda@group.calendar.google.com<\/mark><\/strong> add acls <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">reader<\/mark><\/strong> <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-yellow-color\">default<\/mark><\/strong><\/pre>\n\n\n\n<p>If you want to make a calendar public (so that anyone on the can access it) you use <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-yellow-color\"><code>default<\/code><\/mark><\/strong> as the username. Using <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\"><code>reader<\/code><\/mark><\/strong> provides read-only access.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">List all of the calendar in a users account:<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gam user <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">sample_user<\/mark><\/strong> print calendars showhidden <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">todrive<\/mark><\/strong><\/pre>\n\n\n\n<p>This lists all of the calendars in <code><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">sample_user<\/mark><\/strong>'s<\/code> account in a new Google Sheet (<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\"><code>todrive<\/code><\/mark><\/strong>). This can be handy to find the Calendar ID of a specific calendar.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While web interfaces make things easier, it is often much faster to do things on the command line, especially if you are trying to make changes in bulk.&nbsp; My school recently added Google Calendars for all our sports teams. One trick to make this easier is to use Google Sheets (or Excel) to convert spreadsheet [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,21],"tags":[],"class_list":["post-190","post","type-post","status-publish","format-standard","hentry","category-gam","category-google-workspace"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/duff.io\/index.php?rest_route=\/wp\/v2\/posts\/190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/duff.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/duff.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/duff.io\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/duff.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=190"}],"version-history":[{"count":4,"href":"https:\/\/duff.io\/index.php?rest_route=\/wp\/v2\/posts\/190\/revisions"}],"predecessor-version":[{"id":196,"href":"https:\/\/duff.io\/index.php?rest_route=\/wp\/v2\/posts\/190\/revisions\/196"}],"wp:attachment":[{"href":"https:\/\/duff.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/duff.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/duff.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}