Use Google Workspace to create Google Slides
Use Google Workspace to automate Google Slides in SAP Build Process Automation
Overview
You will learn
- How to use Google Workspace to automate the creation of a new presentation, add slides, a header, a list and an image
- How to retrieve the details of the presentation
Prerequisites
Prerequisites
- Complete Google Authorization tutorial
- Install and set up the Desktop Agent 3 to run the automation
Steps
Intro
In this tutorial, you will build an automation that will create a presentation where you will add one slide with a header and a list and another slide with an image. You will then retrieve the presentation details through a log message that will be read in the test console.
In the Lobby, select the Google Suite project that has been done as part of previous tutorials as mentioned in pre-requisites.
In Build Process Automation, choose Create and then select Automation.

Create Automation In the Create Automation window, enter Google Workspace-Slides as name and An automation to use Google Slides as a description.

Create Automation You will be navigated to the automation editor of the newly created automation.
In the Automation Details panel, under Automations, drag and drop the Google Authorization automation you created.

Google Authorization Automation You will automate the creation of a new Google presentation in Google Slides. In the Automation Details panel, under Tools, search for the activity Create Presentation (Google Slides) and drag and drop it into the workflow.
This activity takes an optional parameter for title of document. If not specified untitled document will be created.
Select the activity. Under Input Parameters as a title type Automation Presentation and select the expression in quotes.

Create Presentation You will now add a slide to the presentation you created. In the Automation Details panel, under Tools, search for the activity Add Slide (Google Slides) and drag and drop it into the workflow.
You will set the parameter for
presentationID, the id of the presentation in which you want to add a slide.Select the activity. Under Input Parameters, for
presentationId, choose the pencil to open the expression editor.Choose as Variables:
presentationDetails>presentationId.Choose Save Expression.

Add Slides Now you will add a header to the slide you added. In the Automation Details panel, under Tools, search for the activity Add Slide Header (Google Slides) and drag and drop it into the workflow.
You will set the parameter for
presentationID, the id of the presentation in which you want to add a header.Select the activity. Under Input Parameters, for
presentationId, choose the pencil to open the expression editor.Choose as Variables:
presentationDetails>presentationId.Choose Save Expression.

Presentation ID Now you will set the parameter for
slideId, the id of the slide in which you want to add a header.Under Input Parameters, for
slideId, choose the pencil to open the expression editor.Choose as Variables:
slideDetails>slideId.Choose Save Expression.

Slide ID For text enter the text to be added in the slide header, here: Hello SAP Build Process Automation! and select the expression in quotes.

Text Next, you will create a list in the slide you added. In the Automation Details panel, under Tools, search for the activity Create list (Google Slides) and drag and drop it into the workflow.
You will set the parameter for
presentationID, the id of the presentation in which you want to add a list.Select the activity. Under Input Parameters, for
presentationId, choose the pencil to open the expression editor.Choose as Variables:
presentationDetails>presentationId.Choose Save Expression.

Presentation ID Now you will set the parameter for
slideID, the id of the slide in which you want to add a list.Under Input Parameters, for
slideId, choose the pencil to open the expression editor.Choose as Variables:
slideDetails>slideId.Choose Save Expression.

Slide ID For text enter the description of the list, here: Welcome to SAP Build Process Automation, you will learn: and select the expression in quotes.

Text For values you will enter the array of values to be added as the list items. Choose the pencil to open the expression editor.
In the expression editor enter the following code:
['How to create a presentation', 'How to create a list', 'How to insert images']Choose Save Expression.

Values You will add a slide to the presentation.
Please note that an existing slide can be updated. To get the slide id for an existing presentation, you can open the slide in the browser and id can be fetched from the 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.
In the Automation Details panel, under Tools, search for the Add Slide (Google Slides) and drag and drop it into the workflow.
You will set the parameter for
presentationID, the id of the presentation in which you want to add a slide.Select the activity. Under Input Parameters, for
presentationId, choose the pencil to open the expression editor.Choose as Variables:
presentationDetails>presentationId.Choose Save Expression.

Add Slide You will now add an image in this slide.
In the Automation Details panel, under Tools, search for the Add Image (Google Slides) and drag and drop it into the workflow.
You will set the parameter for
presentationID, the id of the presentation in which you want to add an image.Select the activity. Under Input Parameters, for
presentationId, choose the pencil to open the expression editor.Choose as Variables:
presentationDetails>presentationId.Choose Save Expression.

Add Slide Now you will set the parameter for
slideID, the id of the slide in which you want to add an image.Under Input Parameters, for
slideId, choose the pencil to open the expression editor.Choose as Variables:
slideDetails>slideId.
CAUTION: Please select the
slideDetailsof step 6 of your automation (the slide you just added)- Choose Save Expression.

Slide ID Finally you will insert the image. For link you will insert the link of the image to be added in the slide.
Link:
https://logos-download.com/wp-content/uploads/2016/08/SAP_logo.pngCAUTION: The URL should start with http:// or https://. The image must be less than 50MB in size, cannot exceed 25 megapixels and must be in PNG, JPEG or GIF format.

Link You will now retrieve the details of your Google Presentation and log them in a message.
In the Automation Details panel, under Tools, search for the activity Get Presentation Details (Google Slides) and drag and drop it into the workflow.
You will set the parameter for
presentationID, the id of the presentation for which you want to get the details.Select the activity. Under Input Parameters, for
presentationId, choose the pencil to open the expression editor.Choose as Variables:
presentationDetails>presentationId.Choose Save Expression.

Get Presentation Details In the Automation Details panel, under Tools, search for the Log Message and drag and drop it into the workflow.
Select the activity. For message parameter, select result to log the details of the presentation.
Finally you will disconnect the Google Account.
In the Automation Details panel, under Tools, search for the Disconnect (Google) and drag and drop it into the workflow.
Save the automation.

Disconnect and Save
You will now test your automation.
Choose Test.
Fill in the Environment Variables:
- For
userEmail: your Gmail user email - For
serviceAccountKeyPath: the full path to the json file

Test - For
Choose Test.

Test The testing was successful. You may see the details of the presentation in the test console.
You may go to your Google Slides and you will see that a presentation called Automation Presentation was successfully created.

Test After opening it, you will see that two slides were successfully created in the presentation. The first with a header and a list, the other with the image.

Test
The entire project is available in the SAP Build Store as a sample and you can follow the below steps to retrieve the project and use it for reference.
To retrieve this sample, please follow these steps:
From the SAP Build Lobby, navigate to Store.
Search for the sample project: How to use Google Workspace.
Choose Add > Create from Template to retrieve the sample and save it as a new project in your lobby.

Store Choose Create.

Create Your project gets created in editable version. You may release and deploy it and run the project.
Navigate back to the lobby by clicking on the SAP logo.

Project You can see your project is available in the lobby.

Lobby
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.