This file contains 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
// 34567890123456789012345678901234567890123456789012345678901234567890123456789 | |
// JSHint - todo | |
/* jshint asi: true */ | |
/* jshint esversion: 6 */ | |
(function() {"use strict"})() | |
// API_.gs | |
// ======= |
This file contains 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
/** | |
* @param {string} value - value to test | |
* @param {array} valuesToTest | |
* | |
* @return the best match in the test array | |
*/ | |
function getBestMatch(value, valuesToTest) { | |
var results = {} |
This file contains 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 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 | |
This file contains 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 testNumber() { | |
var value = 1234.56789 | |
var a = format(value, {numberOfDecimalPlaces: 2}) | |
debugger | |
} | |
function testDate() { | |
var value = new Date() | |
var a = format(value) |
This file contains 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 generateRandomString(n) { | |
var chars = ['a', 'b','c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; | |
chars.push('A', 'B', 'C', 'D', 'E', 'F','G','H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); | |
var randomString = ''; | |
for (i=0; i < n; i++) { | |
r = Math.random(); | |
r = r * 61; | |
r = Math.round(r); | |
randomString = randomString + chars[r]; | |
} |
This file contains 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
// 34567890123456789012345678901234567890123456789012345678901234567890123456789 | |
// JSHint - TODO | |
/* jshint asi: true */ | |
(function() {"use strict"})() | |
// Properties_.gs | |
// ============== | |
// |
This file contains 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
// dev: andrewroberts.net | |
// Replace this with ID of your template document. | |
var TEMPLATE_ID = '' | |
// var TEMPLATE_ID = '1wtGEp27HNEVwImeh2as7bRNw-tO4HkwPGcAsTrSNTPc' // Demo template | |
// Demo script - http://bit.ly/createPDF | |
// You can specify a name for the new PDF file here, or leave empty to use the | |
// name of the template. Placeholders can also be placed in here. |
This file contains 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
// From https://github.com/googlesamples/apps-script-oauth1/blob/master/samples/QuickBooks.gs | |
// Consumer key and secret in Config.gs | |
var OAuth1_ = { | |
/** | |
* Connect to the API | |
*/ | |
This file contains 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
/** | |
* For each placeholder - "{{[placeholder]}}", strip out any HTML and replace | |
* it with the appropriate key value. An example use of this could be using the | |
* HTML from a draft GMail as a template. | |
* | |
* E.g. If the obect were: | |
* | |
* {PlaceHolder1: newValue} | |
* | |
* In the template "{{PlaceHolder1}}" would be replaced with "newValue" even |
This file contains 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
/* | |
PDF Creator - Send multiple PDFs | |
================================ | |
On selecting a number of contiguous rows and clicking "Create PDFs > Create PDFs | |
for selected rows" this script constructs a PDF for each selected row in the | |
attached GSheet. | |
The value in the "File Name" column is used to name the file and - if there is a |
NewerOlder