Copy one slide from a Google presentation to a new google presentation using the API

I want to use the Google api to create a new Google presentation, but with one slide copied from another previous Google presentation.

My question is: is it possible to create a new Google presentation and insert slides (in particular) into a new one. Or can I remove a slide from a Google presentation?

+1
source share
3 answers

Although you are not perfect, you can get closer to the new Google Slides API . You can read the slide from the original presentation, and then try to play it in the destination presentation. At the moment, not all slide functions are supported in the API, so there may be loss of information - this is a process.

+1
source

( 2017) 2016 Google Slides API, , OP, , API. , , , . API Google, : API ( document), ), API Google ( - , ).

, API Google Ruby, . - Google Developers Console API- Google Google , client_secret*.json OAuth2.

, Ruby API- Drive, Ruby API . "" Python ( , , ;)), "" API , Ruby, .

Python, Ruby, , OP, SLIDE_TEMPLATE_FILE, DRIVE - Drive API, SLIDES - API. - PM Ruby, .

# query for template file with one slide
TMPLFILE = SLIDE_TEMPLATE_FILE
rsp = DRIVE.files().list(q="name='%s'" % TMPLFILE).execute().get('files')[0]

# copy template file
DATA = {'name': 'Google Drive & Slides API template DEMO'}
DECK_ID = DRIVE.files().copy(body=DATA, fileId=rsp['id']).execute().get('id')

# create 2 more (1 title-only & 1 blank) slides in copied file
reqs = [
    {'createSlide': {'slideLayoutReference': {'predefinedLayout': 'TITLE_ONLY'}}},
    {'createSlide': {'slideLayoutReference': {'predefinedLayout': 'BLANK'}}},
]
SLIDES.presentations().batchUpdate(body={'requests': reqs},
        presentationId=DECK_ID).execute()

, , deleteObject request, /, . , ONE SLIDE: , ONE SLIDE, . , API " ", .

+1

The API cannot perform this full operation from the API. Although we can createnew or copyexisting presentation of Google. Or we can do this from the interaction of the browser on ctrl+cone slide and ctrl+vin another.

0
source

Source: https://habr.com/ru/post/1666640/


All Articles