Skip to content

Instantly share code, notes, and snippets.

View cwlind's full-sized avatar

Clark Lind cwlind

View GitHub Profile
/*
Create a prefilled URL for a Google Form with 2 questions on it.
*/
function prefillURL() {
try {
// data to pass to Google Form
var shoeSize = 8;
var someText = 'The Gift of Script';
/*
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 30 seconds)
var maxRuntime = 5.5 * 60 * 1000;
/*
/*
Function to iterate through 1 level of sub-folders in a
Google/Shared Drive folder and extract creation/modified dates.
*/
function searchFolders() {
try {
// log start of script in sheet
logEvent('Starting script.');
/*
Function to get Google Form data. Needs onFormSubmit trigger.
*/
function getFormData(e) {
// get Form data
var formValues = e.namedValues;
// get row Form data is written to in spreadsheet
/*
A number of Global Variables to be accessed throughout the scripts to
reduce effort in updating in future.
*/
// Event ID column number
var eventIDCol = 1;
// Status column number
var statusCol = 2;
function docToPDF() {
// ID of Google Doc
var docID = 'ENTER ID HERE';
// ID of destination folder
var folderID = 'ENTER ID HERE';
@cwlind
cwlind / exportSpreadsheet.gs
Last active April 7, 2022 22:18 — forked from Spencer-Easton/exportSpreadsheet.gs
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@cwlind
cwlind / submit.md
Created October 4, 2020 13:03 — forked from tanaikech/submit.md
Google Apps Script: Running Specific Function When Specific Sheet is Edited on Google Spreadsheet

Google Apps Script: Running Specific Function When Specific Sheet is Edited on Google Spreadsheet

This is a sample Google Apps Script for running the specific function when the specific sheet is edited.

Sample script

Please copy and paste the following script to the container-bound script of Spreadsheet and set sheets object.

// When the cells are edited, this function is run by the fire of event trigger.
@cwlind
cwlind / submit.md
Created September 4, 2020 11:23 — forked from tanaikech/submit.md
Using Values Submitted from HTML Form using Google Apps Script

Using Values Submitted from HTML Form using Google Apps Script

This is a sample script for using the values submitted from the HTML form using Google Apps Script and Javascript. In this case, the values include the files.

Issue

<form>
  Text: <input type="text" name="sampleText1" /><br />
 Single file: