我不知道編碼 - 我試圖運行下面的腳本並收到錯誤缺失)在參數lis t在線79 copyDoc.saveAndClose();copyDoc.saveAndClose();缺少)參數列表後Google腳本
塊引用
下面是文檔的URL: https://docs.google.com/document/d/1FcbVBHmCcDfjcaKXSU5UeaOD30h1d5yTyQp_s28VPzc/edit?usp=sharing
這裏是腳本。請指教。真誠的感謝。
function myFunction() {
// [email protected]
// Travel Request
// Get template from Google Docs and name it
var docTemplate = "1FcbVBHmCcDfjcaKXSU5UeaOD30h1d5yTyQp_s28VPzc";
// *** replace with your template ID ***
var docName = "Travel_Request";
// When Form Gets submitted
function onFormSubmit(e) {
//Get information from form and set as variables
var email_address = "[email protected], [email protected]";
var Building = e.values[5];
var Request = e.values[6];
var Total_Days = e.values[7];
var Substitute_Needed = e.values[8];
var Staff_Member_Type = e.values[9];
var Coverage_Type = e.values[10];
var Time_of_Day = e.values[11];
var Coverage = e.values[12];
var Request_Type = e.values[13];
var Destination = e.values[14];
var Purpose = e.values[15];
var City = e.values[16];
var State = e.values[17];
var Purpose_is_related_to = e.values[18];
var Registration = e.values[19];
var Lodging = e.values[20];
var Lodging_Cost = e.values[21];
var Lodging_Total = e.values[22];
var Meals = e.values[23];
var Meals_Cost = e.values[24];
var Meals_Total = e.values[25];
var Mileage = e.values[26];
var Other = e.values[27];
var Travel_Cost = e.values[28];
var Miscellanous = e.values[29];
// Get document template, copy it as a new temp doc, and save the Doc’s id
var copyId = DocsList.getFileById(docTemplate)
.makeCopy(docName+' for '+full_name)
.getId();
// Open the temporary document
var copyDoc = DocumentApp.openById(copyId);
// Get the document’s body section
var copyBody = copyDoc.getActiveSection();
// Replace place holder keys,in our google doc template
copyBody.replaceText('keyDate',
copyBody.replaceText('keyName',
copyBody.replaceText('keyPosition',
copyBody.replaceText('keyBuilding',
copyBody.replaceText('keyRequest',
copyBody.replaceText('keyDayT',
copyBody.replaceText('keySubstitute',
copyBody.replaceText('keyStaff',
copyBody.replaceText('keyDay',
copyBody.replaceText('keyTime',
copyBody.replaceText('keyCoverage',
copyBody.replaceText('keyRequest',
copyBody.replaceText('keyDest',
copyBody.replaceText('keyPurpose',
copyBody.replaceText('keyCity',
copyBody.replaceText('keySt',
copyBody.replaceText('keyPurpRelated',
copyBody.replaceText('keyRT',
copyBody.replaceText('keyLND',
copyBody.replaceText('keyLCP',
copyBody.replaceText('keyLT',
copyBody.replaceText('keyMND',
copyBody.replaceText('keyMCP',
copyBody.replaceText('keyMT',
copyBody.replaceText('keyMLT',
copyBody.replaceText('keyOT',
copyBody.replaceText('keyTotalBOE',
copyBody.replaceText('keyMisc',
// Save and close the temporary document
copyDoc.saveAndClose();
// copyDoc.saveAndClose() (options.cand_email);
// Convert temporary document to PDF
var pdf = DocsList.getFileById(copyId).getAs("application/pdf"
}
謝謝。不幸的是,這並沒有解決我的問題。難道它是在腳本的開頭,它沒有找到文檔? –