Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 已更改为DriveApp仍有相同的问题类型错误:无法读取属性;价值观;从未定义。(第8行,文件“代码”)_Google Apps Script - Fatal编程技术网

Google apps script 已更改为DriveApp仍有相同的问题类型错误:无法读取属性;价值观;从未定义。(第8行,文件“代码”)

Google apps script 已更改为DriveApp仍有相同的问题类型错误:无法读取属性;价值观;从未定义。(第8行,文件“代码”),google-apps-script,Google Apps Script,更改为DriveApp仍有相同的问题和错误消息 var docTemplate = "1nBZvKTMk5b82tiNvMqG3obmbY-lBIpodrIjvH-_sf7g"; var DocName = "SpringHillDisciplineReport"; // When Form Gets submitted function onFormSubmit(e) { //Get information from form and set as variables var email

更改为DriveApp仍有相同的问题和错误消息

var docTemplate = "1nBZvKTMk5b82tiNvMqG3obmbY-lBIpodrIjvH-_sf7g";
var DocName = "SpringHillDisciplineReport";

// When Form Gets submitted
function onFormSubmit(e) {
//Get information from form and set as variables
  var email_address = "kroper@lexrich5.org, lweaver@lexrich5.org, eddavis@lexrich5.org";
  var studentname = e.values[2];
  var studentgrade = e.values[6];
  var date = e.values[5];
  var reportername = e.values[3];
  var locationofincident = e.values[8];
  var reasonforthereferral = e.values[9];
  var presentactiontakenbyadministrator = e.values[13];
  var infractioncode = e.values [10];
  var additionalcomments = e.values[14];

// Get document template, copy it as a new temp doc, and save the Doc’s id
var copyId = DriveApp.getFileById(docTemplate)
.makeCopy(DocName+' for '+ studentname)
.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('keyStudentName', studentname);
copyBody.replaceText('keyDate', date);
copyBody.replaceText('keyStudentGrade', studentgrade);
copyBody.replaceText('keyLocationofIncident', locationofincident);
copyBody.replaceText('keyReasonfortheReferral',reasonforthereferral);
copyBody.replaceText('keyPresentActionTakenbyAdministrator',presentactiontakenbyadministrator);
copyBody.replaceText('keyAdditionalComments', additionalcomments);

// Save and close the temporary document
copyDoc.saveAndClose();

// Convert temporary document to PDF
var pdf = DriveApp.getFileById(copyId).getAs("application/pdf");

// Attach PDF and send the email
var subject = "Discipline Referral Report";
var body = "Here is the Discipline Referral Report for " + studentname + "";
MailApp.sendEmail(email_address, subject, body, {htmlBody: body, attachments: pdf});

// Delete temp file
DriveApp.getFileById(copyId).setTrashed(true);
}
在2014年被弃用的,已经是夕阳,不再发挥作用。依赖DocsList的用户应切换到

应更新代码中使用DocsList的两个位置,以便与DriveApp一起使用


无法从代码编辑器运行此代码,因为它需要表单提交才能正常工作您收到一条错误消息,该值未定义,因为没有提交表单。真正的问题在于DocsList

您是否可以发布您的代码var docTemplate=“1nbzvktmk5b82tinvmqg3obby lBIpodrIjvH-_sf7g”的可能副本;var DocName=“SpringHillDisciplineReport”//当表单被提交时,函数onFormSubmit(e){//从表单获取信息并设置为变量var email_address=”kroper@lexrich5.org, lweaver@lexrich5.org, eddavis@lexrich5.org“var studentname=e.values[2];这是一行,错误为var studentgrade=e.values[6];var date=e.values[5];var reportername=e.values[3];var位置事件=e.值[8];var原因Ferral=e.值[9];var陈述takenbyAdministrator=e.值[13];它不允许我发布整个代码。它已经运行了一年多,我没有做任何更改。今天早上我突然停止了工作。我替换了它,但仍然收到相同的错误。你读了我文章的最后一段吗?你的代码无法从代码编辑器运行。你必须提交一个表单才能使其正常运行。我读了然而,我不是一个程序员,我有一个表单信函,用于与谷歌表单合并的规程,这个脚本将在表单提交上运行,它一直工作到昨天,当我开始出现错误时,我只需要一些指导,我可以做些什么来修复它在这一点上。唯一的测试方法是提交一个表单。你能吗提交一个虚拟表格,看看是否有效?哇!很高兴听到。我以为你会邀请我过来修理它。