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
| //SCRIPT 1 | |
| function makeReports() { | |
| //Get data | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(), | |
| sheet = ss.getActiveSheet(), | |
| data = sheet.getDataRange().getValues(), | |
| company = data[0][0]; | |
| data.splice(0, 2); | |
| //Get report template and report folder IDs |
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
| //Create a text file | |
| function example11() { | |
| DriveApp.createFile("EXAMPLE 11 FILE", "This is a new file"); | |
| } | |
| //Create a PDF | |
| function example12() { | |
| DriveApp.createFile("EXAMPLE 12 PDF FILE", | |
| "This is a new PDF file", MimeType.PDF); | |
| } |
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
| //SCRIPT 1 | |
| function makeInvoice() { | |
| //Get invoice data | |
| const ss = SpreadsheetApp.getActiveSpreadsheet(), | |
| sh = ss.getSheetByName('INVOICES'), | |
| fInvoices = DriveApp.getFolderById('FOLDER ID'), | |
| timeZone = Session.getScriptTimeZone(), | |
| data = sh.getDataRange().getValues(); | |
| var invoiceNumb = data[0][6]; |
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
| //Make reports in Google Docs from data in a Google Sheet, then email them as PDFs | |
| function makeSendReports() { | |
| const ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| const sh = ss.getActiveSheet(); | |
| const [header, ...data] = sh.getDataRange().getDisplayValues(); | |
| const group = header[0].split(" - ")[0]; | |
| const teacher = header[0].split(" - ")[1]; | |
| const docMaster = DriveApp.getFileById('12MEOOsfFrxsQzBXqDe0gOTacncpaDoykTuWgoT5rzqI'); | |
| const placeholders = ['#NAME#', '#GROUP#', '#TEACHER#', '#READING#', '#WRITING#', '#SPEAKING#', '#LISTENING#', '#OVERALL#']; |
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
| //Create new form - Global variable so it can be seen by all functions | |
| const FORM = FormApp.create("Questionnaire"); | |
| function makeQuestionnaire() { | |
| //Get data and last row from spreadsheet | |
| const sh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); | |
| const data = sh.getDataRange().getValues(); | |
| //Loop through each question and check what question type it is | |
| data.forEach(checkQuestionType) |
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() { | |
| const ui = SpreadsheetApp.getUi(); | |
| ui.createMenu('Reports') | |
| .addItem('Make pdfs', 'createReports') | |
| .addItem('Email reports', 'sendEmails') | |
| .addToUi(); | |
| } | |
| function createReports() { | |
| //Get data from sheet and remove header | |
| const ss = SpreadsheetApp.getActiveSpreadsheet(); |
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
| //PART 2 | |
| function onOpen() { | |
| const ui = SpreadsheetApp.getUi(); | |
| ui.createMenu('Admin') | |
| .addItem('Set up forms & sheets', 'setUpForms') | |
| .addToUi(); | |
| } | |
| function setUpForms() { | |
| //Folder to store forms in - Add your own folder ID here |
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
| //Stand alone script file | |
| //SCRIPT 1 | |
| function doGet() { | |
| //Get talks | |
| var ssConf = SpreadsheetApp.openById('SPREADSHEET ID'); | |
| var shTalkInfo = ssConf.getSheetByName('TALKINFO'); | |
| var allTalkInfo = shTalkInfo.getDataRange().getValues(); | |
| allTalkInfo.shift(); | |
| //Build form |
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
| //Bound to a Google Form | |
| //SCRIPT 1 | |
| //Get talks from form submission | |
| function getFormSubmission(e) { | |
| const form = FormApp.getActiveForm(); | |
| //Get list of talks selected | |
| const lastRespNo = form.getResponses().length - 1; | |
| const latestResp = form.getResponses()[lastRespNo]; | |
| const listOfTalks = latestResp.getItemResponses()[0] |
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
| //Bound to a spreadsheet | |
| //SCRIPT 1 | |
| function makeCerts() { | |
| const ss = SpreadsheetApp.getActiveSpreadsheet(), | |
| shCerts = ss.getSheetByName('CERTIFICATES'), | |
| data = shCerts.getDataRange().getValues(); | |
| //Column array references and row numbers | |
| const startRowNum = data[0][4], endRowNum = data[0][6]; |
NewerOlder