Recently, console logging became available for Google Apps Script projects. It used to
be impossible to use the Log service that comes with the GAS runtime, but now all
you need to do is throw
an exception. Exceptions get logged in stackdriver logging and
when enabled, unhandled exceptions will not stop your script execution. This adds up
to nearly 0 lag if you are using this feature (?) by purposely throwing exceptions, and you
can get creative with your error message to avoid having to expand stackdriver's log messages
(which are pretty comprehensive stacktraces!)
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
/* | |
PDF Creator - Email all responses | |
================================= | |
When you click "Create PDF > Create a PDF for each row" this script | |
constructs a PDF for each row in the attached GSheet. 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 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
/* | |
* Save spreadsheet as a PDF | |
* | |
* Based on Dr.Queso's answer in http://stackoverflow.com/questions/30367547/convert-all-sheets-to-pdf-with-google-apps-script/30492812#30492812 | |
* | |
* @param {String} email Where to send the PDF [OPTIONAL] | |
* @param {String} spreadsheetId Or the active spreadsheet[OPTIONAL] | |
* @param {String} sheetName The tab to output [OPTIONAL] | |
* @param {String} PdfName [OPTIONAL] | |
*/ |
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
/* | |
PDF Create - Email on form submit | |
================================= | |
This script creates a PDF populated with the values submitted in a | |
Google form. | |
The "on form submit" trigger needs to be manually created: |
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
/** | |
* Clear all of the config | |
*/ | |
function clearConfig() { | |
Logger.log('Delete Local Script Properties:') | |
if (PropertiesService.getScriptProperties() !== null) { | |
Logger.log(PropertiesService.getScriptProperties().deleteAllProperties()) | |
Logger.log(' Deleted') |
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 getTrialBalancesWithNoDate() { | |
// . | |
// . | |
// . | |
fetchPublicAppData('Reports/TrialBalance', '', '') // OK | |
// . | |
// . |
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
// 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 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
/* | |
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 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
var VALID_COLUMN_INDEX = 4 | |
var EMAIL_COLUMN_INDEX = 3 | |
function onOpen() { | |
SpreadsheetApp | |
.getUi() | |
.createMenu('Validate Emails') | |
.addItem('Validate Sheet', 'validateEmail') | |
.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
function GET_ADDRESS(placeName) { | |
var response = Maps.newGeocoder().geocode(placeName); | |
return response.results[0].formatted_address | |
} |