make.copy()谷歌Api脚本/JavaScript不工作

make.copy()谷歌Api脚本/JavaScript不工作,javascript,google-apps-script,Javascript,Google Apps Script,我正在尝试将谷歌幻灯片复制到驱动器文件夹中。当我运行脚本时,似乎没有定义目标和源的两个变量。我错过了什么 function makeCopy() { var name = SlidesApp.getActivePresentation().getName() + " Copy "; var destination = DriveApp.getFolderById("1234567890"); //

我正在尝试将谷歌幻灯片复制到驱动器文件夹中。当我运行脚本时,似乎没有定义目标和源的两个变量。我错过了什么

   function makeCopy() {
    
      var name = SlidesApp.getActivePresentation().getName() + " Copy ";
      var destination = DriveApp.getFolderById("1234567890");
    
    // gets the current Google Sheet file
      var source = SlidesApp.getActivePresentation();
    
    // makes copy of "file" with "name" at the "destination"
      source.makeCopy(name, destination);
    }

SlidesApp.getActivePresentation()
返回一个,但它是一个方法

不要让
source
存储演示文稿,而是使用to并存储它

function makeCopy() {
  var name = SlidesApp.getActivePresentation().getName() + " Copy ";
  var destination = DriveApp.getFolderById("123j3GbzhSB3m8xG-MijssMkynXHxNanl");

  // gets the current Google Sheet file
  var source = DriveApp.getFileById(SlidesApp.getActivePresentation().getId());

  // makes copy of "file" with "name" at the "destination"
  source.makeCopy(name, destination);
}