Automating Google Calendar, Google Docs and Google Slides using SAP Build Process Automation
SAP Build Process Automation provides Google Workspace SDK which can be used to automate Google Workspace products like Gmail, Sheets, Drive, Calendar, Docs and Slides. The activities provided by the SDK are grouped into different modules each for automating a Google Workspace product.
In this blog post I would like to introduce modules to automate Google Calendar, Google docs and Google Slides. This blog will be helpful for those who use Google Workspace products as office suite and are looking to automate it. The activities to automate these are available in Google Workspace SDK and requires an authorization with the help of activities in Google Authorization SDK. For more information on authorization required for Google Workspace SDK, please refer Authorizing SAP Build Process Automation to automate Google Applications
Once authorized then Google workspace SDK lets you to automate Google Workspace products. On the SAP Build Process Automation side, we need to create an automation and add the Google Authorization SDK and Google Workspace SDK along with Core SDK.
Managing meetings can be automated using Google Calendar activities.
Activities like Fetch Busy Information or List Events can be used to check calendar details and when participants of a meeting would be available between certain time intervals. Let’s look at the Fetch Busy Information activity and its parameters,
Fetch Busy Information : This activity gets meeting schedules information of a user.
calendarBusyInfoParameters Data type to define the identifier of the calendar and the interval when a specific user is busy. Which accepts from and to time, values as shown below
CalendarIds : Semilcolon separated google calendarIds e.g. firstname.lastname@example.org
calendarBusyInfo Busy Info for the specified Calendar
It contains calendarId and busyInfo i.e Start and End time of the event
calendarsbusyInfo.busyInfo.length === 0 would indicate that user with calendarId email@example.com is free and meeting request can be sent.
Once you want to send the meeting request, there is a Create Event activity to help you create the meeting request. It is possible update or delete events using Update Event and Delete Event activities.
To Get an event details like evenetType, description or location etc., we can use Get Event Activity
eventId: Unique Identifier for the event
calendarId: Unique Identifier for the calendar. If you want to access the primary calendar then use the keyword primary
event: Google Event
Note: Calendar activities need https://www.googleapis.com/auth/calendar scope. This has to be provided in the authorization activity.
You may need to create a document and would like to do an update to it. SDK has activities to help automate creation of document and update it.
Create Doc activity will create a document in “my drive”. This activity takes an optional parameter for title of document. If not specified untitled document would be created.
Create Document: This activity creates a new document
Title: Name of the new document
createdDocument New Google Document created in my drive.
documentId: Unique Identifier for the document.
title: Title of the document, it is name given to the document.
revisionId: revisionId of the document, each time google document is updated it returns the revisionId.
Google Documents can be updated with other activities using the document Id. If you need to fetch document Id for an existing document, we can get that by opening the document in the browser, url will have the document Id.
Content in the document can be updated using Insert Text activity. Currently there is no support for styles in Google docs automation activities and this has to be done manually. Let’s look at the Replace Text activity from Google Docs module
Replace Text: Replaces the matching texts in a Google Document with new value
documentId: Unique Identifier for the document
textToBeReplaced: Text which should be replaced
replaceText: Text to replace
matchCase: Whether the search of text is case-sensitive
ocuurencesChanged: Number of occurrences changed for the specified text
Note: Docs activities need https://www.googleapis.com/auth/drive scope. This has to be provided in the authorization activity.
It is possible to automate Google Slides using Google Workspace SDK. You can create a new presentation using Create Presentation activity. This activity takes an optional parameter for title, if not specified, an untitled presentation will be created.
Create Presentation: Creates a new presentation
Title: Name for the slide
presentationId: Unique Identifier for the slide
title: Title of the document
revisionId: revisionId of the document
An existing slide can be updated. To get slide id for an existing presentation, you can open the slide in the browser and id can be fetched from url.
Once slide id is obtained, one can use Add Slide, Add Image, Add Text and Add Slide Header etc. activities within a slide to update it. It is also possible to add list and table in the slide. To get details about a presentation we can use Get Presentation Details activity
Get Presentation Details: Get presentation details such as slides and layout
presentationId: Unique identifier for the slide
An object represented by Presentation
Note: Slides activities need https://www.googleapis.com/auth/drive scope. This has to be provided in the authorization activity.
- Google Workspace SDK documentation
- Authorizing SAP Build Process Automation to automate Google Applications
- Using Google Workspace SDK to process purchase order information and create a sales order in SAP S/4HANA Cloud
- Automating Google Cloud Storage using SAP Build Process Automation