这是代码。由于调查对象提交表单时使用触发器,因此我无法进行调试。如何通过google apps脚本保存文档?
// This code opens the doc and names it what you wanted it named above. It also appends any other language to the title that you wish. My sample below will title each document as docName + 'for' + Lname or (OA Graduate Assistant Application for Last Name of user).
var copyId = DriveApp.getFileById(docTemplate)
.makeCopy(docName+' for '+ Lname)
.getId();
// Open the temporary document
var copyDoc = DocumentApp.openById(copyId);
// Get the document’s body section
var copyBody = copyDoc.getActiveSection();
//code that makes edits
copyBody.replaceText('keyTimestamp', Timestamp);
copyBody.replaceText('keyPemail', Pemail);
//define the source folder to save the file in
var dir = DriveApp.getFolderById(folderid);
//add this file to the source folder
dir.addFile(copyDoc);
copyDoc.saveAndClose();
没有文件存储在指定的文件夹和我的整个谷歌驱动器。有什么问题?所有的变量都被正确定义(我只是省略了var语句)。
是值被传递给[getFileById(ID)](https://developers.google.com/apps-script/reference/drive/drive-app#getfilebyidid),一个有效驱动器的文件ID? – noogui
是该文件是有效 – NoMoreErrors
有没有办法如果没有发生的事情,我可以调试此问题 – NoMoreErrors