This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getActiveUser(sheet) { | |
| // get active Tutor email address | |
| var user = Session.getActiveUser().getEmail(); | |
| Logger.log('Active Tutor email is: ' + user); | |
| // get data from Tutors sheet to lookup name from email address | |
| var tutorsSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Tutors'); | |
| var tutorsSheetData = tutorsSheet.getRange(2, 1, 2, 2).getValues(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function testGetActiveUser() { | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| var groupSheet = ss.getSheetByName('Group Feedback'); | |
| // run function to determine if Tutor 1 or 2 | |
| var whoAmI = getActiveUser(groupSheet); | |
| Logger.log('Value of whoAmI is: ' + whoAmI); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getValues() { | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| var groupSheet = ss.getSheetByName('Group Feedback'); | |
| var groupSheetName = groupSheet.getSheetName(); | |
| var numCols = groupSheet.getLastColumn(); | |
| var numRows = groupSheet.getLastRow(); | |
| // get 2-D list of 'Student Name' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <base target="_top"> | |
| <link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css"> | |
| <style> | |
| h1 { | |
| color:#fff; | |
| background-color:#006B77; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function writeBack(form) { | |
| // get the form values | |
| var currentRow = form.currentRow; | |
| var whoAmI = form.whoAmI; | |
| Logger.log('whoAmI from Form is: ' + whoAmI); | |
| var attendance1 = form.attendance1; | |
| var contribution1 = form.contribution1; | |
| var attitude1 = form.attitude1; | |
| var comments1 = form.comments1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function onOpen() { | |
| SpreadsheetApp.getUi() | |
| .createMenu('Feedback') | |
| .addItem('Send Student Email', 'sendEmailsConfirm') | |
| .addToUi(); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function createStudentDocs() { | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| ss.toast('Starting to create Student Docs'); | |
| var configSheet = ss.getSheetByName('Config'); | |
| var groupSheet = ss.getSheetByName('Group Feedback'); | |
| var groupNumRows = groupSheet.getLastRow(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function toUpperCase() { | |
| // lowercase text to convert | |
| var lower = 'hello'; | |
| // apply uppercase method | |
| var upper = lower.toUpperCase(); | |
| // log output | |
| Logger.log(upper); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function organiseDate() { | |
| // example date string | |
| var messyDate = 'Thu Dec 20 2018 13:12:21 GMT-0000 (GMT)'; | |
| // create a new date variable | |
| var newDate = new Date(messyDate); | |
| // format the new date variable as required | |
| var niceDate = Utilities.formatDate(newDate, "GMT", "YYYY_MM_dd"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function convertToPDF() { | |
| // ID of current Google doc | |
| var docID = '123456789'; | |
| // ID of new folder location | |
| var folderID = '987654321'; | |
| // create PDF version of doc ************************************************* | |
| var docFile = DriveApp.getFileById(docID); |