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
| /** | |
| * The time manager manages the time in your script. The timemanager keeps track of | |
| * the time spend and can tell you how much time is left. | |
| * | |
| * This manager is usefull in background scripts that will be killed by apps script | |
| * after some time. Every time before starting an operation you can see if you can | |
| * acquire time to perform the operation. If there is not enough time left you can | |
| * exit the program gracefully. | |
| * | |
| * @param {object} spec - specification for the construction of the object |
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
| steps: | |
| - id: authenticate-clasp | |
| name: gcr.io/cloud-builders/gcloud | |
| entrypoint: 'bash' | |
| args: ['-c', "gcloud secrets versions access latest --secret=${_SECRET_ID} --format='get(payload.data)' | tr '_-' '/+' | base64 -d > ~/.clasprc.json" ] | |
| - id: configure-clasp | |
| name: gcr.io/cloud-builders/gcloud | |
| entrypoint: 'bash' | |
| args: ['-c', 'echo {\"scriptId\":\"${_SCRIPT_ID}\"} > .clasp.json' ] | |
| - id: install-clasp |
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 myTimer() { | |
| // timing example | |
| console.time("demo") | |
| Utilities.sleep(50); | |
| console.timeEnd("demo"); | |
| } |
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 myLogger() { | |
| // console statements | |
| console.error("Hi, I am an error"); | |
| console.warn("Hello, I am a warning"); | |
| console.info("Hi, this is information that can be useful"); | |
| console.log("Hello, this is FYI") | |
| } |
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 myDebugger() { | |
| // debugger example | |
| const globalNumber = 0; | |
| // when in debug mode the code will stop here | |
| debugger; | |
| // print the value of globalNumber to the log | |
| console.log(globalNumber); |
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 the customFunctions object | |
| let customFunctions = sheetFunctions.customFunctions(); | |
| // fetch the custom function and pass the parameters | |
| let customFunction = (f, ...params) => { | |
| return customFunctions.getFunction(f, params); | |
| } | |
| /** | |
| * Multiplies the input value by 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
| /** | |
| * The customFunctions | |
| * @return {Object} The customFunctions Object. | |
| */ | |
| function customFunctions() { | |
| /** | |
| * A custom function that converts meters to miles. | |
| * | |
| * @param {Number} meters The distance in meters. | |
| * @return {Number} The distance in miles. |
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
| /** | |
| * The appObjectV8 | |
| * @param {Object} specs the construction specifications in JSON format. | |
| * @return {Object} The appObjectV8 object. | |
| */ | |
| const appObjectV8 = (specs) => { | |
| 'use strict'; | |
| const logManager = specs.logManager || console; | |
| const objectName = 'appObjectV8'; | |
| const someParameter = specs.someParameter; |
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
| /** | |
| * The appObjectV8 | |
| * @param {Object} specs the construction specifications in JSON format. | |
| * @return {Object} The appObjectV8 object. | |
| */ | |
| const appObjectV8 = (specs) => { | |
| 'use strict'; | |
| const logManager = specs.logManager || console; | |
| const objectName = 'appObjectV8'; | |
| const someParameter = specs.someParameter; |
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
| /** | |
| * The appObjectV8 | |
| * @param {Object} specs the construction specifications in JSON format. | |
| * @return {Object} The appObjectV8 object. | |
| */ | |
| const appObjectV8 = (specs) => { | |
| 'use strict'; | |
| const logManager = specs.logManager || console; | |
| const objectName = 'appObjectV8'; | |
| const someParameter = specs.someParameter; |
NewerOlder