function onFormSubmit(e) {
const responses = e.values;
const timestamp = responses[0];
const school = responses[1];
const level = responses[2];
const term = responses[3];
const year = responses[4];
const subject = responses[5];
// Create document
const doc = DocumentApp.create(
subject + " Scheme of Work - " + level + " " + term + " " + year
);
const body = doc.getBody();
body.appendParagraph("SCHEME OF WORK")
.setBold(true)
.setFontSize(16)
.setAlignment(DocumentApp.HorizontalAlignment.CENTER);
body.appendParagraph("\nSchool: " + school);
body.appendParagraph("Level: " + level);
body.appendParagraph("Term: " + term);
body.appendParagraph("Year: " + year);
body.appendParagraph("Subject: " + subject);
body.appendParagraph("\n");
body.appendParagraph("WEEKLY BREAKDOWN")
.setBold(true);
const weeks = [
"Week 1 – Introduction & Orientation",
"Week 2 – Listening and Speaking",
"Week 3 – Reading Skills",
"Week 4 – Writing Skills",
"Week 5 – Grammar and Language Use",
"Week 6 – Assessment and Revision"
];
weeks.forEach(function(week){
body.appendParagraph(week);
body.appendParagraph("Learning Activities: Teacher-led and learner-centered activities.");
body.appendParagraph("Assessment: Oral questions, written exercises.\n");
});
body.appendParagraph("Prepared by: baptiste254.blogspot.com")
.setItalic(true);
doc.saveAndClose();
// Add link back to Sheet
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const lastRow = sheet.getLastRow();
sheet.getRange(lastRow, 7).setValue(doc.getUrl());
}
0 Comments