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 copyDoc_Paragraphs() { | |
// document ID of the file to be copied | |
var docId = 'insert your file ID'; | |
// instruct DriveApp to get this document | |
var templateDoc = DriveApp.getFileById(docId); | |
// folder ID of where the copied file is to be saved | |
var folderId = 'insert your folder ID'; |
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 splitUrlFile(Url) { | |
// remove this line when you incorporate into your script | |
var Url = 'https://drive.google.com/open?id=1ZvhkehvoL99EmmzUsy481givp31odMaO'; | |
// split the Url via the equals sign to break into two | |
var split = Url.split('='); | |
// the file ID is the second part of the split (first part being zero) | |
var uploadID = split[1]; |
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 setUrlLink(docUrl, name) { | |
// existing document Url - remove this line when you incorporate into your script | |
var docURL = 'https://docs.google.com/document/d/1vo_mGPR_n54PoLDhgXOfYwkHCC3qb9J1JA_icbneMm4/'; | |
// suitable name for text to display in spreadsheet - remove this line when you incorporate into your script | |
var name = 'Finance Spreadsheet'; | |
// get relevant spreadsheet items | |
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); |
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 onFormSubmit(e) { | |
// ******************************* get sheet data ****************************** | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var formResponse = ss.getSheetByName('Form Responses 3'); | |
var numCols = formResponse.getLastColumn(); | |
var configArray = ss.getSheetByName('config').getDataRange().getValues(); | |
Logger.log(configArray); | |
// *************************** end of get sheet data *************************** |
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 pushToArray() { | |
// create an empty array | |
var students = [] | |
Logger.log('students array starts empty: ' + students); | |
// array with items to be pushed | |
var age = [7,8,9]; | |
// loop through each item and push into empy array |
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 extractUrlID() { | |
// example Url | |
var Url = 'https://docs.google.com/file/d/0B-FYu_D7D7x4REdtRVEzVH0eU0/edit'; | |
// use a regex to extract the ID | |
var expression = Url.match(/[-\w]{25,}/); | |
Logger.log(expression); | |
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 createGroupSheets() { | |
// get relevant Sheets | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var studentSheet = ss.getSheetByName('Students'); | |
var studentSheetName = studentSheet.getSheetName(); | |
var studentSheetValues = studentSheet.getDataRange().getValues(); | |
var studentLastRow = studentSheet.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 addPermissions() { | |
// get relevant Sheets | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var groupSheet = ss.getSheetByName('Groups'); | |
var groupSheetName = groupSheet.getSheetName(); | |
var groupSheetValues = groupSheet.getDataRange().getValues(); | |
var groupLastRow = 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 checkData(sheetName, sheet, lastRow, lastCol) { | |
Logger.log('Last Row is: ' + lastRow); | |
Logger.log('Last Column is: ' + lastCol); | |
var data = sheet.getRange(2, 1, lastRow, lastCol).getValues(); | |
// loop through each Column *********************************************** | |
for (var i=0; i<lastCol; i++) { |
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 validationPopup(sheetName, column, j) { | |
var ui = SpreadsheetApp.getUi(); | |
var result = ui.alert( | |
'Blank cell found in ' + sheetName + ' sheet', | |
'Please check cell: ' + column + (j+2), | |
ui.ButtonSet.OK); | |
} |