-2

I have a slide under URL:https://docs.google.com/presentation/d/1IGsdwhich is a source slide and cannot be "touched". Now, I want to programmatically make a copy of this source slide every week and save it under the name "slide_{timestamp}" in my root google drive folder to do manipulations on those.

Can someone help on how to approach this or existing code which may help? Thanks!

Marios
  • 26,333
  • 8
  • 32
  • 52
cesarteaser
  • 111
  • 1
  • 8

1 Answers1

1

Go to your source slide, click on Tools => Script editor and copy-paste the following function:

function copySourceSlide() { 
  const presentation = SlidesApp.getActivePresentation();
  const destFolder = DriveApp.getFolderById("folderId");
  DriveApp.getFileById(presentation.getId()).makeCopy(`slide_${new Date().toLocaleString()}`, destFolder);
} 

This code will create a copy of the source slide with a name slide_datetime to a particular folder of your choice, indicated by folderId.

If you want to create a weekly trigger event for a particular day and hour, you can do it either manually or programmatically like that:

function createTimeDrivenTriggers() {

  // Trigger every Monday at 09:00.
  ScriptApp.newTrigger('copySourceSlide')
      .timeBased()
      .onWeekDay(ScriptApp.WeekDay.MONDAY)
      .atHour(9)
      .create();
}

References:

Marios
  • 26,333
  • 8
  • 32
  • 52