{"id":197,"date":"2022-04-12T14:46:32","date_gmt":"2022-04-12T14:46:32","guid":{"rendered":"http:\/\/duff.io\/?p=197"},"modified":"2022-04-12T14:46:32","modified_gmt":"2022-04-12T14:46:32","slug":"onboarding-new-users-with-gam-with-an-assist-from-cloudhq","status":"publish","type":"post","link":"https:\/\/duff.io\/?p=197","title":{"rendered":"Onboarding new users with GAM with an assist from CloudHQ"},"content":{"rendered":"\n<p>When someone is hired at my school, our HR system sends tech support an automated message with some basic information (first name, last name, start date, personal email address, job title, supervisor, etc.). Unfortunately, this isn&#8217;t formatted the best and I used to copy\/paste the information from this email into an onboarding Google Sheet I used to mange the process.<\/p>\n\n\n\n<p>I decided to try to improve on this process. I wanted the email to automatically go into my Google Sheet. While I&#8217;d love it if our payroll system could pass along the data I need in JSON format via a webhook\/API call, alas it can&#8217;t do that. I figured that I could write some App Script to parse the emails and grab the data that way. However, before coding, I always like to check if someone has already solved the problem. CloudHQ has an add-on called &#8220;<a href=\"https:\/\/www.emails-to-sheets.com\">Export Email to Sheets<\/a>&#8221; which does exactly what its name suggests. For any email with a given Gmail label (I match on sender and subject) it parses the email and adds the results to a Google Sheet.<\/p>\n\n\n\n<p>As I covered in a previous blog post, I like writing GAM-ADV-XTD3 commands a Google Sheet formulas. I can create an account and send the password to the users personal email with the following Google Sheet formula:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">=\"gam create user \" &amp; (left(<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">I2<\/mark><\/strong>,find(\"@\",<strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">I2<\/mark><\/strong><\/strong>)-1)) &amp; \" firstname \"\"\" &amp; <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">A2<\/mark><\/strong> &amp; \"\"\" lastname \"\"\" &amp; <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-yellow-color\">B2<\/mark><\/strong> &amp; \"\"\" password random changepassword on notify \" &amp; <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">E2<\/mark><\/strong><\/pre>\n\n\n\n<p>Here is a key to the fields I&#8217;m using:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\"><code>I2<\/code><\/mark><\/strong><\/td><td>A field with the new school email address we are creating<\/td><\/tr><tr><td><code>(left(<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">I2<\/mark><\/strong>,find(\"@\",<strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">I2<\/mark><\/strong><\/strong>)-1))<\/code><\/td><td>Calculates into the part of their email address before the @ symbol<\/td><\/tr><tr><td><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\"><code>A2<\/code><\/mark><\/strong><\/td><td>A field with the first name of the new hire<\/td><\/tr><tr><td><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-yellow-color\"><code>B2<\/code><\/mark><\/strong><\/td><td>A field with their last name of the new hire<\/td><\/tr><tr><td><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\"><code>E2<\/code><\/mark><\/strong><\/td><td>The personal email address of the new hire<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>To create an account for me:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">gam create user <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">ssimon<\/mark><\/strong> firstname \"<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Shandor<\/mark><\/strong>\" lastname \"<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-yellow-color\">Simon<\/mark><\/strong>\" password random changepassword on notify <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">shandor@mypersonalemaildomain.com<\/mark><\/strong><\/pre>\n\n\n\n<p>Once the account is created there are a few other useful GAM commands:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Put the new <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">user<\/mark> in an <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">OU<\/mark><\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gam update user <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">ssimon<\/mark><\/strong> org \"<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">\/Faculty and Staff<\/mark><\/strong>\"<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Add the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">user<\/mark> to a <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">group<\/mark><\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gam update group <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-medium-pink-color\">staff@myschooldomain.org<\/mark> add member user <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">ssimon<\/mark><\/strong><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When someone is hired at my school, our HR system sends tech support an automated message with some basic information (first name, last name, start date, personal email address, job title, supervisor, etc.). Unfortunately, this isn&#8217;t formatted the best and I used to copy\/paste the information from this email into an onboarding Google Sheet I [&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-197","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\/197","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=197"}],"version-history":[{"count":2,"href":"https:\/\/duff.io\/index.php?rest_route=\/wp\/v2\/posts\/197\/revisions"}],"predecessor-version":[{"id":199,"href":"https:\/\/duff.io\/index.php?rest_route=\/wp\/v2\/posts\/197\/revisions\/199"}],"wp:attachment":[{"href":"https:\/\/duff.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/duff.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/duff.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}