Function has a trigger for on form submit
having issues with this very first line. Its supposed to grab data from excel sheet to auto-populate into a copy of template
function autofillGoogleDocFromForm(e) {
var timeStamp = e.value[0];
var lastname = e.value[1];
var firstname = e.value[2];
var rank = e.value[3];
var gender = e.value[4];
var last4ssn = e.value[5];
var age = e.value[6];
var phonenumber = e.value[7];
var email = e.value[8];
var MOSAOC = e.value[9];
var BN = e.value[10];
var BTRY = e.value[11];
var platoonsection = e.value[12];
var region = e.value[13];
var laterality = e.value[14];
var painduration = e.value[15];
var DOI = e.value[16];
var MOI = e.value[17];
var HPI = e.value[18];
var stability = e.value[19];
var variability = e.value[20];
var aggs = e.value[21];
var eases = e.value[22];
var prevtx = e.value[23];
var imaging = e.value[24];
var painc = e.value[25];
var painl = e.value[26];
var painh = e.value[27];
var profile = e.value[28];
var medhx = e.value[29];
var surg = e.value[30];
var famhx = e.value[31];
var tobaccou = e.value[32];
var tobaccof = e.value[33];
var tobaccoc = e.value[34];
var meds = e.value[35];
var legweak = e.value[36];
var nt = e.value[37];
var wtchange = e.value[38];
var fcns = e.value[39];
var appetite = e.value[40];
var bbchange = e.value[41];
var ddh = e.value[42];
var sihi = e.value[43];
var bhchap = e.value[44];
var goals = e.value[45];
var important = e.value[46];
var confident = e.value[47];
var C19contact = e.value[48];
var C19travel = e.value[49];
var C19sx = e.value[50];
var templateFile = DriveApp.getFileById("");
var templateResponseFolder = DriveApp.getFolderById("");
var copy = templateFile.makeCopy(lastname + ',' + firstname, templateResponseFolder);
var doc = DocumentApp.openById(copy.getId());
var body = doc.getBody();
body.replaceText("{{date}}", timeStamp);
body.replaceText("{{last}}", lastname);
body.replaceText("{{first}}", firstname);
body.replaceText("{{rank}}", rank);
body.replaceText("{{gender}}", gender);
body.replaceText("{{id}}", last4ssn);
body.replaceText("{{age}}", age);
body.replaceText("{{phone}}", phonenumber);
body.replaceText("{{email}}", email);
body.replaceText("{{mos}}", MOSAOC);
body.replaceText("{{bn}}", BN);
body.replaceText("{{btry}}", BTRY);
body.replaceText("{{plt}}", platoonsection);
body.replaceText("{{region}}", region);
body.replaceText("{{laterality", laterality);
body.replaceText("{{doi}}", DOI);
body.replaceText("{{moi}}", MOI);
body.replaceText("{{hpi}}", HPI);
body.replaceText("{{stability}}", stability);
body.replaceText("{{variability}}", variability);
body.replaceText("{{aggs}}", aggs);
body.replaceText("{{eases}}", eases);
body.replaceText("{{prevtx}}", prevtx);
body.replaceText("{{imaging}}", imaging);
body.replaceText("{{painc}}", painc);
body.replaceText("{{painl}}", painl);
body.replaceText("{{painh}}", painh);
body.replaceText("{{profile}}", profile);
body.replaceText("{{medhx}}", medhx);
body.replaceText("{{surg}}", surg);
body.replaceText("{{famhx}}", famhx);
body.replaceText("{{tobaccou}}", tobaccou);
body.replaceText("{{tobaccof}}", tobaccof);
body.replaceText("{{tobaccoc}}", tobaccoc);
body.replaceText("{{meds}}", meds);
body.replaceText("{{legweak}}", legweak);
body.replaceText("{{nt}}", nt);
body.replaceText("{{wtchange}}", wtchange);
body.replaceText("{{fcns}}", fcns);
body.replaceText("{{appetite}}", appetite);
body.replaceText("{{bbchange}}", bbchange);
body.replaceText("{{ddh}}", ddh);
body.replaceText("{{sihi}}", sihi);
body.replaceText("{{bhchap}}", bhchap);
body.replaceText("{{goals}}", goals);
body.replaceText("{{important}}", important);
body.replaceText("{{confident}}", confident);
body.replaceText("{{c19travel}}", C19travel);
body.replaceText("{{c19sx}}", C19sx);
body.replaceText("{{c19contact}}", C19contact);
doc.saveAndClose();
}