Here is the code:
const ss = SpreadsheetApp.getActiveSpreadsheet();
const ws = ss.getSheetByName("StudentReport_all");
const range = ws.getRange(4,1,ws.getLastRow(),ws.getLastColumn());
const data = range.getValues();
var form = FormApp.openById("154QspMd1P4RmTRDnOQHL06dU-KvL8FPU53wHYcar09U");
//form.setRequireLogin(true);
var formUrl = form.getPublishedUrl();
var title = form.getTitle();
var descriptionText = form.getDescription();
function sendForm() {
var subject = "Response Needed: " + form.getTitle()
var response = UrlFetchApp.fetch(formUrl);
var template = HtmlService.createHtmlOutput(response);
//var htmlBody = HtmlService.createHtmlOutputFromFile("teacherEmail").getContent();
var htmlBody = template.getContent();
//HtmlService
var p1Email = data[9][3];
var p2Email = data[10][3]
var p3Email = data[11][3]
var p4Email = data[12][3]
var p5Email = data[13][3]
var p6Email = data[14][3]
GmailApp.sendEmail(
[p1Email],
subject,
htmlBody,
{htmlBody:htmlBody}
)
return htmlBody
Logger.log(htmlBody);
}
When I try to run this code, which accesses a Google Sheets for in order to access emails to send a google form to, the email shows up as this:1,2. The google form in the email can not be interacted with and it is in a weird format (my JavaScript on my browser is enable by the way). How can I fix this?