创建有关“ DriveApp.createFile”的文件

问题描述 投票:0回答:1

我尝试创建有关命令“ DriveApp.createFile ....”的Google表格文件。当我运行脚本时,我总是得到错误提示“错误的参数”。

function myFunction() {
  // This command is Running
  DriveApp.createFile('New HTML File', '<b>Hello, world!</b>', MimeType.HTML);

  // This command is NOT Running
  DriveApp.createFile('DOC', 'Hello, world!', MimeType.GOOGLE_SHEETS);
  DriveApp.cre
}

Link to the Google-Documentation

enter image description here

enter image description here

有人知道我的错在哪里吗?

谢谢

google-api drive createfile
1个回答
0
投票

DriveApp.createFile()不再支持GOOGLE_SHEETS。您也可以使用DRIVE API进行相同的操作。

var resource = {
      title: name,
      mimeType: MimeType.GOOGLE_SHEETS,
      parents: [{ id: folderId }]
    };  
var file = Drive.Files.insert(resource);
© www.soinside.com 2019 - 2024. All rights reserved.