2

Is there a way to "Publish to the Web..." a Google Slides presentation programmatically?

enter image description here

Unlike Sheets, Slides takes in additional parameters for publishing. I am trying to figure out how to push the presentation programmatically and get the published URL for use in my application.

enter image description here

Any help is greatly appreciated.

Kos
  • 4,890
  • 9
  • 38
  • 42
Bhuvan
  • 1,523
  • 4
  • 23
  • 49

2 Answers2

3

I haven't found publishing feature using Google Slides API. For this, you may want to file a feature request.

Using Google Drive API, you may want to check Publishing revisions,

For Google Docs, Sheets, and Slides you can publish any revision to the web by setting the published property. If the file is created in a G Suite domain, the publishedOutsideDomain property indicates whether the revision is accessible by anyone or if it is restricted to users of the domain.

Watch the video of Google engineer discussing related tips and tricks for more information.

Teyam
  • 7,686
  • 3
  • 15
  • 22
  • 1
    Thanks @Teyam. This greatly helped. Google Drive API has a generic updateRevisions method, where I had to pass published=true & publishedOutsideDomain=true to make it publish to web. – Bhuvan Sep 09 '17 at 16:43
  • 1
    @Bhuvan could you write that up as an answer? I'm trying to do the same thing. – Ben Jun 13 '18 at 05:23
  • @Bhuvan how did you get the embed link after setting the published parameter to true? I tried to get both the revision and file but the published parameter only returns the boolean value (as it should). Do the API create a new parameter with the embed url? – ygbr Jul 25 '18 at 20:27
  • 1
    I used got the document link.. and manipulated the URL to form the final published link. Get an embed link from the UI. Get the document Id programmatically and replace it in the link you got form embed slide wizard. It is working for now. Fingers Crossed. – Bhuvan Jul 27 '18 at 16:46
  • 2
    Same here. I used `https://drive.google.com/file/d/${id}/preview` to embed the google slide content, it seems work for me. But I am not sure this is a good practice. Would love to hear if some has better solution. – Daisy QL Jan 28 '19 at 16:05
  • Instead of the `https://docs.google.com/presentation/d/e/$ID/pub?start=false&loop=false&delayms=3000` embed url which has a different `$ID` than the main presentation url id you can use `https://docs.google.com/presentation/d/$ID/present` where `$ID` is the same as the main presentation url – Tim Apr 22 '19 at 03:44
  • @Tim this only works if the slide is publicly accessible to the world (it does not have to be published however). – mfleshman May 10 '19 at 13:53
0

You can set permissions from google drive API creating a permission with https://developers.google.com/drive/api/v3/reference/permissions/create including in request_body the attributes "role":"reader", "type":"anyone", "allowFileDiscovery": false ( getting a "anyoneWithLink" id permission) and setting the head revision (the last) to published with https://developers.google.com/drive/api/v3/reference/revisions including in request body the attibutes "published": true, "publishAuto": true, "publishedOutsideDomain": true,

Enrico Ferreguti
  • 438
  • 4
  • 13