Google DRIVE API - Upload a Microsoft PowerPoint file to Google DRIVE and convert to Google Slides

Andrew_239256
Andrew_239256 Posts: 16 admin
edited January 12 in API Actions

The following guide utilizes the Google DRIVE API to upload a Microsoft PowerPoint file to Google DRIVE and convert it to a Google Slides Presentation.

While native actions in Catalytic allow builders to interact with Google DRIVE in several ways, builders can further leverage the standard Google DRIVE integration using the existing GET, POST, PUT, PATCH, and DELETE API actions to access a broader set of endpoints within the Google DRIVE API library.

With Catalytic managing API authentication, this functionality allows builders a quick and simple way of extending Catalytic’s Google DRIVE integration to accomplish custom Google DRIVE actions within a workflow.

To get started, please follow the instructions below:

Step 1: Set up Google DRIVE integration

Note: If a Google DRIVE integration has already been set up, move to step 2.

For detailed instructions on how to set up a Google DRIVE integration, reference the following help article within the Catalytic knowledgebase:
https://help.catalytic.com/docs/google-drive-integration-setup-guide/

Step 2: Configure Instance Fields

Create one new Instance Field for reference within the workflow.
Field name: PowerPoint File
Type: File
Default value:

Step 3: Configure Catalytic action to upload an PowerPoint spreadsheet to Google DRIVE

In a new or existing workflow, add a new action of type ‘Web API: Send POST Request’. Configure as follows:

Integration:
API endpoint:
https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart

Headers:
Content-Type: multipart/related; boundary=foo_bar_baz

Request body:

--foo_bar_baz
Content-Type: application/json; charset=UTF-8

{
 "name": "Sample Deck.pptx",
  "parents":["Add Parent ID Here - Only if file should go in specific folder"],
'mimeType': 'application/vnd.google-apps.presentation'
}
--foo_bar_baz
Content-Type: application/vnd.openxmlformats-officedocument.presentationml.presentation
Content-Transfer-Encoding: base64

{{powerpoint-file}}
--foo_bar_baz--

Note: name is the new file name displayed in Google DRIVE after the file is uploaded. Replace 'Sample Deck.pptx' with a file name of your choice.

*IMPORTANT: The file must be sent to Google encoded as a base64 file. Change 'File encoding format' in the POST API options to 'Base64'. Screen shot below:

Full customization of the request body is beyond the scope of this guide. For more information about uploading files to Google DRIVE, please reference the Google DRIVE API documentation:
https://developers.google.com/drive/api/v3/manage-uploads

Step 4: Test your workflow

By clicking on the test button, the selected PowerPoint file will be uploaded to Google DRIVE and converted into a Google Slides presentation.

Please reference the sample workflow attached for testing purposes. To customize for your building needs, update the spreadsheet ID and sheet name.