Skip to Content
Product Information
Author's profile photo Vikas Gupta

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. 

   

Google Calendar: 

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. 

Input Parameters: 

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 

from: 2022-08-21T10:00:00+05:30 

to: 2022-08-21T10:00:00+05:30 

CalendarIds : Semilcolon separated google calendarIds e.g. xyzcal@googleworkspace.com 

Output Parameters: 

calendarBusyInfo Busy Info for the specified Calendar 

It contains calendarId and busyInfo i.e Start and End time of the event 

calendarsbusyInfo[0].busyInfo.length === 0 would indicate that user with calendarId xyzcal@googleworkspace.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 

Get Event 

Input parameters: 

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  

Output parameters: 

event: Google Event  

 

Note:  Calendar activities need https://www.googleapis.com/auth/calendar scope. This has to be provided in the authorization activity. 

Google Docs: 

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 

Input Parameters: 

Title: Name of the new document 

Output Parameters: 

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 

Input parameters: 

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 

Output parameters: 

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. 

Google Slides: 

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 

Input parameters: 

Title: Name for the slide 

Output Parameters: 

presentationDetails 

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 

Input parameters: 

presentationId: Unique identifier for the slide 

Output Parameters: 

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. 

Additional References: 

Recommended Resources: 

 

 

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.