這是代碼。由於調查對象提交表單時使用觸發器,因此我無法進行調試。如何通過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