Home>

The Google auto-reply script we used so far suddenly stopped working.
Even if I read the error text, I can't find any problems in the relevant part. Is there a problem with the code?

Error text

TypeError: Unable to read property "namedValues" from undefined. (Line 11, file "code")

Applicable source code
function sendEmailSchool (e) {
  ///// Get data from spreadsheet (specify by column name of sheet)
  var timestamp = e.namedValues ​​['timestamp'];
  var ps_attendance = e.namedValues ​​['Attendance form'];
  var name = e.namedValues ​​['name'];
  var name_kana = e.namedValues ​​['furigana'];
  var address = e.namedValues ​​['address'];
  var tel = e.namedValues ​​['phone number'];
  var email = e.namedValues ​​['email address'];
  var work = e.namedValues ​​['job type'];
  var company = e.namedValues ​​['company name'];
  var gender = e.namedValues ​​['Gender'];
  var age = e.namedValues ​​['age'];

  /////// Notification to snubber mail
  var address = '○○○○';// Destination
  var title1 = '【○○○○】' + name;// Subject
  var content = '';// text
  content + = "Name:" + name + "\ n";
  content + = "phonetic:" + name_kana + "\ n";
  content + = "phone number:" + tel + "\ n";
  content + = "email address:" + email + "\ n \ n";
  // content + = "https://docs.google.com/spreadsheets/d/1kGnNpmUHIhoz0aOlKqV0ofG_t5jrTV173tvO35dACcQ/edit#gid=519660460";
  content + = SpreadsheetApp.getActiveSpreadsheet (). getUrl ();
  // ↑ If i use this method, you can get the active spreadsheet URL now. If i use this, you do not have to change the URL every time. 201905237 itomura
  GmailApp.sendEmail (address, title1, content);
  /////// Notify applicant
  var title2 = '[○○○○] Application acceptance complete';// Subject
  var content2 = '';// text
  content2 + = name + "Like" + "\ n \ n";
  content2 + = "Thanks for your application. \ n";
  content2 + = "The interview will take place on Wednesday, January 8 \ n";
  content2 + = "The details of the interview time will be contacted again after the application period ends. \ n";
  content2 + = "Please note that those who continue to take the course are exempt from the interview and orientation, so please come to the first day of the lecture. \ n \ n";
  content2 + = "□ ■ ━━━━━━━━━━━━━━━━━ \ n"
  content2 + = "○○○○ \ n"
  content2 + = "Business hours 10:00 to 21: 00 \ n"
  content2 + = "Address: 〒 ○○○○ \ n"
  content2 + = "○○○○ \ n"
  content2 + = "¥ n"
  content2 + = "○○○○○○ \ n"
  content2 + = "Business hours 9:00-22:00 (weekdays)/11: 00-19:00 (Saturdays, Sundays and holidays) \ n"
  content2 + = "Address: 〒 ○○○○ \ n"
  content2 + = "○○○○○○○○ \ n"
  content2 + = "━━━━━━━━━━━━━━━━━ ■ □"

  GmailApp.sendEmail (email, title2, content2);
  }
  • Answer # 1

    content2 + = "□ ■ ━━━━━━━━━━━━━━━━━ \ n"
      content2 + = "○○○○ \ n"
      content2 + = "Business hours 10:00 to 21: 00 \ n"
      content2 + = "Address: 〒 ○○○○ \ n"
      content2 + = "○○○○ \ n"
      content2 + = "¥ n"
      content2 + = "○○○○○○ \ n"
      content2 + = "Business hours 9:00-22:00 (weekdays)/11: 00-19:00 (Saturdays, Sundays and holidays) \ n"
      content2 + = "Address: 〒 ○○○○ \ n"
      content2 + = "○○○○○○○○ \ n"
      content2 + = "━━━━━━━━━━━━━━━━ ■ □"

    The semicolon is not the above line.

Related articles