Created
February 25, 2019 09:00
-
-
Save seinecle/922951a4807f5024f4278d576d56f60c to your computer and use it in GitHub Desktop.
How to create and edit a Google Slide via the Java API client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// login and credentials steps are skipped | |
// because it is such a mess | |
// I found no example anywhere of how to build and edit a new Google Slides presentation via the Java API client. | |
// So here you go: how to create two empty slides. | |
Presentation prezTemp = new Presentation(); | |
prezTemp.setTitle("test_" + String.valueOf(Math.random())); | |
prez = googleSlides.presentations().create(prezTemp).execute(); | |
BatchUpdatePresentationRequest update = new BatchUpdatePresentationRequest(); | |
Request request = new Request(); | |
Request request1 = new Request(); | |
CreateSlideRequest slide = new CreateSlideRequest(); | |
request.setCreateSlide(slide); | |
request1.setCreateSlide(slide); | |
List<Request> requests = new ArrayList(); | |
requests.add(request); | |
requests.add(request1); | |
update.setRequests(requests); | |
googleSlides.presentations().batchUpdate(prez.getPresentationId(), update).execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment