Saturday, November 25, 2023
HomeSoftware DevelopmentAutomate workflows for Google Workspace

Automate workflows for Google Workspace



Posted by Mike Procopio, Senior Employees Software program Engineer

This week, we launched the Apps Script connector for AppSheet, which now makes it potential to name Apps Script code features from a no-code AppSheet app. This significantly extends the skills of AppSheet apps by letting them entry the facility that Apps Script offers. For instance, an AppSheet app can now use Apps Script to automate workflows with Google Workspace utilizing the Workspace APIs for Drive, Docs, Sheets, and Admin SDK, and extra – in addition to different Google companies like YouTube, Google Analytics, and BigQuery.

Google AppSheet

AppSheet is Google’s platform for constructing no-code customized apps and workflows to automate enterprise processes. It lets app creators construct and deploy end-to-end apps and automations with out writing code.

Modifying an App Definition in Google Appsheet

Overview of No-Code

Earlier than we dive into the Apps Script connector characteristic, let’s check out what we imply by no-code. No-code platforms like AppSheet allow citizen builders to shortly construct apps mechanically by means of knowledge evaluation utilizing web-based person interfaces. These are sometimes constructed on high of an information supply like Google Sheets, MySQL, Salesforce, or different database. Creating these apps doesn’t require a conventional software program engineering background; enterprise technologists and analysts with a variety of talent units can construct apps that make their work simpler and extra environment friendly.

In a no-code platform like AppSheet, an app creator makes use of a web-based editor UI to outline how the app ought to behave, as a substitute of writing particular code to realize that. They’ll specify issues like what the app ought to do, what knowledge supply it is constructed on, what the information means, what UI the person sees, what occasions to hear for and what actions to take after they happen, and so forth. The app is then deployed in manufacturing as an end-to-end, data-driven app with a UI, all with out “writing” any precise code. That is all clear to the top person, who merely sees an ordinary internet or native app.

Why No-Code Works Properly

In follow, no-code platforms work very properly for a big class of apps. Why? As a result of many apps are functionally very related – specifically people who implement inner enterprise processes. These apps share many widespread traits: A knowledge supply for storing knowledge, an idea of an information “file,” UIs and types to gather and edit knowledge, user-specific views of that knowledge, expressions to outline transformations of knowledge, actions to take when knowledge is modified, admin controls to handle permissions, and so forth.

For instance, think about an app for creating and approving an worker journey request. This app shares many widespread traits with an app for, say, creating and approving expense studies. In each apps, an worker creates a file which will get reviewed and annotated, customers are notified when modifications are made, and finally the request is accomplished and closed out. Equally, an inner app for monitoring staff’ assigned laptop gear has lots in widespread with any generic stock monitoring, success, and ordering system.

A no-code platform’s problem is at all times balancing expressiveness with high-level abstraction. Happily, enterprise processes have a tendency to adapt to a well-understood core set of expectations round knowledge, knowledge lifecycle, and course of. Because of this no-code platforms carry out properly on this area. Nonetheless, there could also be instances when the necessities of the app transcend what a no-code platform can present. The brand new Apps Script connector significantly improves the expressiveness (capabilities) of a no-code app – guaranteeing that the app can develop to accommodate altering necessities or enterprise processes as they evolve.

Google Workspace, Workspace APIs, and Apps Script

Google Workspace is Google’s cloud-based productiveness suite, enabling groups of all sizes to attach, create, and collaborate. Chances are you’ll be accustomed to many of those apps, like Gmail, Calendar, Drive, Docs, Sheets, Slides, and others. Every of those apps additionally comes with a robust developer API that lets app builders programmatically combine with it. For instance, the Drive API permits its customers to add and obtain information with code, the Gmail API lets apps combine with its messaging features, and the Google Docs API permits script-based enhancing of Google Docs.

Utilizing Google Workspace integrating Chat, Gmail, and doc previews

Apps Script is a low-code platform that makes it fast and straightforward to construct enterprise options that combine, automate, and prolong Google Workspace. It does this by offering easy-to-use high-level “wrappers” round APIs, enabling customized integrations with Google Workspace and exterior companies. Apps Script additionally integrates with Google companies akin to YouTube, Google Analytics, and BigQuery. It’s a highly effective platform, enabling script authors to implement advanced enterprise logic and macros and name exterior companies, for instance a third-party vendor’s knowledge trade system or a machine studying classification service.

Modifying a script within the Google Apps Script code editor

Introducing the Apps Script connector for AppSheet

The Apps Script connector for AppSheet, launched this week, ties all the pieces collectively: AppSheet, Apps Script, Google Workspace, and Google Workspace’s many developer APIs. This integration lets no-code app builders utilizing AppSheet significantly prolong the capabilities of their no-code apps by permitting them to name and go knowledge to Apps Script features. A method to consider this integration is that it bridges no-code (AppSheet) with low-code (Apps Script). Importantly, the one who writes the Apps Script script doesn’t must be the identical because the no-code AppSheet app creator that calls the script (and infrequently received’t be).

From the Apps Script developer perspective, this opens the door to some vital capabilities. One among AppSheet’s largest advantages is that it permits you to simply deploy an precise end-to-end app with a UI (frontend). With the brand new means to name your current Apps Script code, creating or changing any current front-end with a no-code AppSheet app turns into a probably game-changing possibility.

Utilizing the Apps Script connector for AppSheet

In AppSheet, configuring that is simple and requires no code apart from the script itself. The core thought is that the app creator chooses the Apps Script script to name by configuring an AppSheet “Job,” which is an motion taken when an AppSheet Automation is triggered.

Such an motion sometimes happens within the context of a selected knowledge row in AppSheet’s knowledge supply; for instance, an automation could possibly be triggered when a brand new knowledge file is created by one of many app’s finish customers. Lastly, the app creator can specify values to go in to the parameters of the Apps Script operate based mostly on values within the energetic knowledge file.

Modifying an Automation Job in Google AppSheet

Right here’s learn how to set this up in 5 straightforward steps:

  1. In AppSheet, choose the Automation display, create a brand new Bot with an related Occasion to hear for, and eventually and select the Name a script possibility for the Job:

    Configuring an AppSheet Automation Job to name an Apps Script operate

  2. Then, below “Apps Script Undertaking,” select the script to name. This code might be created utilizing the Apps Script editor, and might be in App Creator’s Google Drive (it may be shared with them by another person):

    Selecting the Apps Script Undertaking to name from Google Drive

  3. As soon as chosen, an inventory of the accessible features within the Apps Script mission might be proven within the Perform title dropdown. Right here, select the operate to name from AppSheet.
  4. After the operate to name is chosen, an inventory of its parameters — extra knowledge handed in when calling the operate – is then proven.

    Displaying the parameters to go to the logTravelRequestUpdate() Apps Script operate

  5. For every operate parameter, use the AppSheet Expression Assistant to specify what worth to go for the parameter when the automation is known as. An expression is usually a easy column within the AppSheet app’s knowledge supply, or a extra advanced operate or computation involving a number of columns.
  6. Utilizing the AppSheet Expression Assistant to decide on which values to go to the Apps Script operate parameters

Lastly, save the Job within the AppSheet Editor utilizing the Save button.

And that’s it! When the automation is triggered (for instance, when a person provides a brand new knowledge row), the AppSheet automation engine will name the desired Apps Script operate, passing within the values from the evaluated expressions as operate arguments. Particulars concerning the operate name might be accessible within the AppSheet Automation Monitor.

Instance Code

Right here’s a easy instance you possibly can attempt by yourself based mostly on a Journey Request Instrument AppSheet app proven within the above screenshots. (Extra examples are additionally given within the Pattern Scripts part under.) The code under is an Apps Script operate that provides particulars about an worker journey request to a Google Docs doc simulating an “audit log”. It makes use of the Google Docs API through the DocumentApp wrapper library accessible in Apps Script.


 TravelRequestAuditLogger.gs 

operate logTravelRequestUpdate(RequestDate, Requestor, Origin, ...) {
  var TRAVEL_REQUEST_AUDIT_LOG_DOCID = 'your_docid_here'
  var doc = DocumentApp.openById(TRAVEL_REQUEST_AUDIT_LOG_DOCID)
  var physique = doc.getBody();

  var dataParagraph = physique.insertParagraph(0, '');
  var headerText = dataParagraph.appendText('*** NEW AUDIT LOG ENTRY ***n');
  headerText.setBold(true);

  // Add within the audit log entry metadata.
  dataParagraph.appendText('New Journey Request Instrument audit log entry...n');

  dataParagraph.appendText('RequestDate: ' + RequestDate + 'n');
  dataParagraph.appendText('Requestor: ' + Requestor + 'n');
  dataParagraph.appendText('Origin: ' + Origin + 'n');

  // ... extra values right here to append to Google Doc
}

When this operate is known as, for instance from an AppSheet automation when a brand new journey request is created, textual content might be added to the Google Docs doc based mostly on values handed in from AppSheet. The doc will look much like under when it’s up to date:

Instance Google Docs doc output, created from utilizing the Google Docs API in Apps Script with values handed in from AppSheet

Getting Began

We’ve created an inventory of sources that will help you shortly get began and get group help.

Pattern Scripts

Listed here are three pattern scripts we’ve created that will help you get began.

Pattern Google Workspace Undertaking – Create a Doc, Sheet, Slide or ship an E-mail.

Create a Calendar Occasion – Create a customizable Calendar occasion.

Ship an interactive Chat message – Ship a message in Google Chat that opens a hyperlink or shows a picture.

We’re very enthusiastic about this announcement and we are able to’t wait to see what you construct for Google Workspace! To remain within the loop on bulletins about AppSheet and the Google Workspace Platform, please subscribe to our developer e-newsletter.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments