Totally new to javascript, but I'm able to hack together existing pieces. I'm a bit stuck now.
I have a script that joins together a bunch of Q + As from a Google Form. A lot of the questions are optional, but I'm not sure how to skip those lines, so it still prints the questions and line breaks.
var form = FormApp.getActiveForm();
var formResponses = form.getResponses();
var formResponse = formResponses[formResponses.length-1];
var itemResponses = formResponse.getItemResponses();
// ---------
// create the notes portion of the form
var notes = "XYZ Submission \n\n";
for (var j = 0; j < itemResponses.length; j++) {
var itemResponse = itemResponses[j];
// add each Q & A to the notes and then add 2 endlines if the response isn't blank
if (itemResponse.getResponse() != null) {
notes = notes + itemResponse.getItem().getTitle() + "\n" + itemResponse.getResponse() + "\n\n";
}
}
What am I doing wrong here?