我试过这个脚本将行数据提取到一个数组中。前两列的数据能够提取,但收集的其余列数据显示为“未定义”。谁能指导我脚本中发生的错误?
在其他工作表中也进行了同样的尝试,效果很好,但不是基于表单的电子表格?任何人都可以拉出这个脚本背后的错误吗
function sendEmails3() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Issues");
var startRow = 2; // First row of data to process
var numRows = sheet.getLastRow(); // Number of rows to process
var dataRange = sheet.getRange(startRow, 1, numRows, 3)
// Fetch values for each row in the Range.
var data = dataRange.getValues();
var message_body2= new Array();
var message_body1 = " <html> <body> <table> <tbody>"
+"<tr> <th> Timestamp </th> "
+" <th> Program</th> "
+" <th> District</th> "
+" <th> Type to Issue</th> "
+" <th> Name</th> "
+" <th> Mobile Number</th> "
+" <th> Personal Mail ID</th> "
+" <th> Issue Description (not more that 100 words) if more, Kindly mail to ap_admin@drreddysfoundation.org</th> "
+" <th> Share us the duration, since how many days the issue persist. ( in DAYS)</th> "
+" <th> Center Mail ID</th> "
+" <th> Issue Addressed</th> "
+" <th> Issue Addressed Date</th> ";
var message_body3 = "</tbody> </table> </body> </html>";
for (var i = 0; i < data.length; ++i) {
var row = data[i];
var timeStamp = row[0]; // timestamp column
var addressedDate = row[11];
if (addressedDate != "" && timeStamp != "") { // Prevents sending duplicates
message_body2[i] = "</tr> <tr> "
+" <td>" + row[0] + "</td> "
+" <td> "+ row[1] + " </td> "
+" <td> "+ row[2] + " </td> "
+" <td> "+ row[3] + " </td> "
+" <td> "+ row[4] + " </td> "
+" <td> "+ row[5] + " </td> "
+" <td> "+ row[6] + " </td> "
+" <td> "+ row[7] + " </td> "
+" <td> "+ row[8] + " </td> "
+" <td> "+ row[9] + " </td> "
+" <td> "+ row[10]+ " </td> "
+" <td> "+ row[11]+ " </td> "
+" <td> "+ row[12]+ " </td> " + "</tr> " ;
}
Browser.msgBox( row[2] + " - " + row[3] + " - " + row[4] + " - " + row[5] + " - " + row[6] + " - " + row[7] + " - " + row[8] + " - " + row[9] + " - " + row[10]+ " - " + row[11]+ " - " + row[12]);
}
var complete_message = message_body1 + message_body2+ message_body3;
// check data accumulated
Browser.msgBox(complete_message);
// export to a cell all the extracted data to verifiy
sheet.getRange(i, 3).setValue(complete_message);
}