以下代码一直向我提供“Missing; before statement”。错误信息。在线查看语法错误的示例后,我对于导致错误的原因感到很遗憾。我想我只是忽略了它,但我很感激你帮助指出线条的确切误差。
错误发生在“问题1”之后,我的图像也将在问题2-5的整个行中继续。
var message = '<h4>Dear </h4>' + row1[0] + '<h4>; </h4>';
message += '<h6>The following information has been complied from the <strong> Instructor Surveys </strong> completed by our patrons.</h6>';
message += '<br>';
message += '<h5>Winter</h5>';
message += '<br>';
message += '<p><strong>Question 1</strong></p>';
message += row3[1] "<p>:<p>" + row4[1] + "<strong> of </strong>" + row4[3] "</p>"; // Syntax Error Starts Here - Missing ; before statement
message += row3[6] '<p>:<p>' + row4[6] + '<strong> of </strong>' + row4[8] '</p>';
message += row3[11] '<p>:<p>' + row4[11] + '<strong> of </strong>' + row4[13] '</p>';
message += '<p><strong>Question 2</strong></p>';
message += row3[1] '<p>:<p>' + row5[1] + '<strong> of </strong>' + row5[3] '</p>';
message += row3[6] '<p>:<p>' + row5[6] + '<strong> of </strong>' + row5[8] '</p>';
message += row3[11] '<p>:<p>' + row5[11] + '<strong> of </strong>' + row5[13] '</p>';
message += '<p><strong>Question 3</strong></p>';
message += row3[1] '<p>:<p>' + row6[1] + '<strong> of </strong>' + row6[3] '</p>';
message += row3[6] '<p>:<p>' + row6[6] + '<strong> of </strong>' + row6[8] '</p>';
message += row3[11] '<p>:<p>' + row6[11] + '<strong> of </strong>' + row6[13] '</p>';
message += '<p><strong>Question 4</strong></p>';
message += row3[1] '<p>:<p>' + row7[1] + '<strong> of </strong>' + row7[3] '</p>';
message += row3[6] '<p>:<p>' + row7[6] + '<strong> of </strong>' + row7[8] '</p>';
message += row3[11] '<p>:<p>' + row7[11] + '<strong> of </strong>' + row7[13] '</p>';
message += '<p><strong>Question 5</strong></p>';
message += row3[1] '<p>:<p>' + row8[1] + '<strong> of </strong>' + row8[3] '</p>';
message += row3[6] '<p>:<p>' + row8[6] + '<strong> of </strong>' + row8[8] '</p>';
message += row3[11] '<p>:<p>' + row8[11] + '<strong> of </strong>' + row8[13] '</p>';
以下是我的完整代码,用于从Google表格中提取数据以包含在个性化电子邮件中。
var EMAIL_DRAFTED = 'EMAIL DRAFTED';
function draftMyEmails() {
var sheet = SpreadsheetApp.getActiveSheet() // Use data from the active sheet
var startRow = 2; // First row of data to process
var numRows = sheet.getLastRow() - 1; // Number of rows to process
var lastColumn = sheet.getLastColumn(); // Last column
var dataRange = sheet.getRange(startRow, 1, numRows, lastColumn) // Fetch the data range of the active sheet
var data = dataRange.getValues(); // Fetch values for each row in the range
// Work through each row in the spreadsheet
for (var a = 1; a < data.length; ++a)
for (var b = 2; b < data.length; ++b)
for (var c = 3; c < data.length; ++c)
for (var d = 4; d < data.length; ++d)
for (var e = 5; e < data.length; ++e)
for (var f = 6; f < data.length; ++f)
for (var g = 7; g < data.length; ++g)
for (var h = 8; h < data.length; ++h)
for (var i = 9; i < data.length; ++i)
for (var j = 10; j < data.length; ++j)
for (var k = 11; k < data.length; ++k)
for (var l = 12; l < data.length; ++l)
for (var m = 13; m < data.length; ++m)
for (var n = 14; n < data.length; ++n)
for (var o = 15; o < data.length; ++o)
for (var p = 16; p < data.length; ++p)
for (var q = 17; q < data.length; ++q)
for (var r = 18; r < data.length; ++r)
for (var s = 19; s < data.length; ++s)
for (var t = 20; t < data.length; ++t)
for (var u = 21; u < data.length; ++u)
for (var v = 22; v < data.length; ++v)
for (var w = 23; w < data.length; ++w)
for (var x = 24; x < data.length; ++x)
for (var y = 25; y < data.length; ++y)
for (var z = 26; z < data.length; ++z)
for (var aa = 27; aa < data.length; ++aa)
for (var ab = 28; ab < data.length; ++ab)
for (var ac = 29; ac < data.length; ++ac)
for (var ad = 30; ad < data.length; ++ad)
for (var ae = 31; ae < data.length; ++ae)
for (var af = 32; af < data.length; ++af)
{
var row1 = data[a]; // Row of Data to reference
var row2 = data[b]; // Row of Data to reference
var row3 = data[c]; // Row of Data to reference
var row4 = data[d]; // Row of Data to reference
var row5 = data[e]; // Row of Data to reference
var row6 = data[f]; // Row of Data to reference
var row7 = data[g]; // Row of Data to reference
var row8 = data[h]; // Row of Data to reference
var row9 = data[i]; // Row of Data to reference
var row10 = data[j]; // Row of Data to reference
var row11 = data[k]; // Row of Data to reference
var row12 = data[l]; // Row of Data to reference
var row13 = data[m]; // Row of Data to reference
var row14 = data[n]; // Row of Data to reference
var row15 = data[o]; // Row of Data to reference
var row16 = data[p]; // Row of Data to reference
var row17 = data[q]; // Row of Data to reference
var row18 = data[r]; // Row of Data to reference
var row19 = data[s]; // Row of Data to reference
var row20 = data[t]; // Row of Data to reference
var row21 = data[u]; // Row of Data to reference
var row22 = data[v]; // Row of Data to reference
var row23 = data[w]; // Row of Data to reference
var row24 = data[x]; // Row of Data to reference
var row25 = data[y]; // Row of Data to reference
var row26 = data[z]; // Row of Data to reference
var row27 = data[aa]; // Row of Data to reference
var row28 = data[ab]; // Row of Data to reference
var row29 = data[ac]; // Row of Data to reference
var row30 = data[ad]; // Row of Data to reference
var row31 = data[ae]; // Row of Data to reference
var row32 = data[af]; // Row of Data to reference
// Assign each row a variable
//Winter Session Data
// Prevent from drafing duplicates and from drafting emails without a recipient
if (emailStatus !== EMAIL_DRAFTED && email) {
// Build the email message
var message = '<h4>Dear </h4>' + row1[0] + '<h4>; </h4>';
message += '<h6>The following information has been complied from the <strong> Instructor Surveys </strong> completed by our patrons.</h6>';
message += '<br>';
message += '<h5>Winter</h5>';
message += '<br>';
message += '<p><strong>Was the instructor friendly and enthusiastic?</strong></p>';
message += row3[1] "<p>:<p>" + row4[1] + "<strong> of </strong>" + row4[3] "</p>";
message += row3[6] '<p>:<p>' + row4[6] + '<strong> of </strong>' + row4[8] '</p>';
message += row3[11] '<p>:<p>' + row4[11] + '<strong> of </strong>' + row4[13] '</p>';
message += '<p><strong>Did you feel that your child was safe during class?</strong></p>';
message += row3[1] '<p>:<p>' + row5[1] + '<strong> of </strong>' + row5[3] '</p>';
message += row3[6] '<p>:<p>' + row5[6] + '<strong> of </strong>' + row5[8] '</p>';
message += row3[11] '<p>:<p>' + row5[11] + '<strong> of </strong>' + row5[13] '</p>';
message += '<p><strong>Did the instructor actively provide demonstrations?</strong></p>';
message += row3[1] '<p>:<p>' + row6[1] + '<strong> of </strong>' + row6[3] '</p>';
message += row3[6] '<p>:<p>' + row6[6] + '<strong> of </strong>' + row6[8] '</p>';
message += row3[11] '<p>:<p>' + row6[11] + '<strong> of </strong>' + row6[13] '</p>';
message += '<p><strong>Did it seem like the instructors always had a plan?</strong></p>';
message += row3[1] '<p>:<p>' + row7[1] + '<strong> of </strong>' + row7[3] '</p>';
message += row3[6] '<p>:<p>' + row7[6] + '<strong> of </strong>' + row7[8] '</p>';
message += row3[11] '<p>:<p>' + row7[11] + '<strong> of </strong>' + row7[13] '</p>';
message += '<p><strong>Was there constant feedback to your child and was it understandable?</strong></p>';
message += row3[1] '<p>:<p>' + row8[1] + '<strong> of </strong>' + row8[3] '</p>';
message += row3[6] '<p>:<p>' + row8[6] + '<strong> of </strong>' + row8[8] '</p>';
message += row3[11] '<p>:<p>' + row8[11] + '<strong> of </strong>' + row8[13] '</p>';
// Create the email draft
GmailApp.createDraft(
email, // Recipient
'Instructor Feedback - ' + row[0], // Subject
'', // Body (plain text)
{
htmlBody: message // Options: Body (HTML)
}
)
sheet.getRange(startRow + i, lastColumn).setValue(EMAIL_DRAFTED); // Update the last column with 'EMAIL_DRAFTED'
SpreadsheetApp.flush(); // Make sure the last cell is updated right away
}
}
}
答案 0 :(得分:0)
您的代码中缺少一些+
个符号;)
message += row3[1] + "<p>:<p>" + row4[1] + "<strong> of </strong>" + row4[3] + "</p>";
在所有行中。