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 to check if date in spreadsheet is less than todays date. | |
* If so then autofill formulas down a row. | |
* Run via daily Trigger. | |
* | |
* @OnlyCurrentDoc | |
*/ | |
function autofill() { |
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 getFormData(e) { | |
// get all Form responses | |
var formValues = e.namedValues; | |
// get response to specific question | |
var pizzaTopping = formValues["Favourite Pizza Topping"][0]; | |
console.log("pizzaTopping is: " + pizzaTopping); | |
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 to sort through an array of duplicates, to then create a new array of | |
unique values. | |
*/ | |
function sortArray() { | |
// array to sort | |
var messyArray = ['A', 'B', 'A', 'C', 'B', 'B', 'B']; |
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
/* | |
Some Global Variables to make it easier to keep a track of changing column | |
positions, etc. | |
*/ | |
// 'Folder Name' column number | |
var folderNameCol = 1; | |
// 'Folder Link' column number | |
var folderLinkCol = 2; |
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 saveToProperties() { | |
// save to User Properties in one go | |
var userProperties = PropertiesService.getUserProperties(); | |
var newProperties = { | |
sourceFolderId: '123', | |
destinationFolderId: '456', | |
}; | |
userProperties.setProperties(newProperties); |
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
/* | |
Some Global Variables to make it easier to keep a track of changing column | |
positions, etc. | |
*/ | |
// 'File Link' column number | |
var fileLinkCol = 2; | |
// Maximum runtime of script in minutes to prevent timeout (5 minutes) | |
var maxRuntime = 5 * 60 * 1000; |
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 menu item to run script from spreadsheet. | |
*/ | |
function onOpen() { | |
SpreadsheetApp.getUi() | |
.createMenu('Create Doc') | |
.addItem('Create Doc', 'getSpreadsheetData') | |
.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
/* | |
Global Variables that may need to be tweaked and are easier to access by placing here. | |
*/ | |
// Maximum runtime of script in minutes to prevent timeout (5 minutes) | |
var maxRuntime = 5 * 60 * 1000; | |
/* |
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 switchActiveView() { | |
// get spreadsheet | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
// get cell range in destination sheet that the view will be switched to | |
var range = ss.getRange('Sheet2!A1'); | |
// activate cell range so cursor moves to that position and changes the current view | |
range.activateAsCurrentCell(); |
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
/* | |
Search a date range in Google Calendar for events matching a given string | |
and then delete them. | |
*/ | |
function deleteEvents() { | |
// start date (MM/DD/YYYY) | |
var startDate = new Date('11/01/2022'); |