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 - 27 Feb 2016 21:19 | |
/* jshint asi: true */ | |
/* | |
* Copyright (C) 2016 Andrew Roberts | |
* | |
* This program is free software: you can redistribute it and/or modify it under | |
* the terms of the GNU General Public License as published by the Free Software |
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 |
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 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
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
// 34567890123456789012345678901234567890123456789012345678901234567890123456789 | |
// JSHint: 22 March 2015 08:56 GMT | |
// Unit Tests: 22 March 2015 08:50 GMT | |
/* | |
* Copyright (C) 2015-2017 Andrew Roberts (andrew@roberts.net) | |
* | |
* This program is free software: you can redistribute it and/or modify it under | |
* the terms of the GNU General Public License as published by the Free Software |
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 Create - with rename and email | |
================================== | |
When you click "Create PDF>Create PDF" this script uses the data from | |
the active row to construct a PDF in your GDrive. The value in the | |
"File Name" column is used to name the file and - if there is a | |
value - it is emailed to the recipient in the "Email" column. |
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 onOpen() { | |
SpreadsheetApp | |
.getUi() | |
.createMenu('Terrain') | |
.addItem('Generate terrain map', 'createTerrain') | |
.addToUi(); | |
} |
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 GET_ADDRESS(placeName) { | |
var response = Maps.newGeocoder().geocode(placeName); | |
return response.results[0].formatted_address | |
} |
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 getTrialBalancesWithNoDate() { | |
// . | |
// . | |
// . | |
fetchPublicAppData('Reports/TrialBalance', '', '') // OK | |
// . | |
// . |