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
| /** | |
| * Logs information to a Google Spreadsheet for tracking and debugging purposes. | |
| * | |
| * @param {string} functionName - The name of the function being logged. | |
| * @param {string} functionState - The state or status of the function being logged. | |
| * @param {string|object} message - The log message to be recorded, which can be a string or an object. | |
| * @param {string} spreadsheetUrl - The URL of the logging spreadsheet. | |
| */ | |
| function logToSpreadsheet(functionName, functionState, message, spreadsheetUrl) { | |
| // Get the active sheet of the Google Spreadsheet |
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
| /** | |
| * Replaces the domain of a URL with the domain of another URL. | |
| * | |
| * @param {string} url1 - The first URL containing the target domain to be replaced. | |
| * @param {string} url2 - The second URL containing the replacement domain. | |
| * @returns {string} - The modified URL with the domain replaced. | |
| */ | |
| function replaceDomain(url1, url2) { | |
| // Regular expression pattern to match the domain of a URL | |
| let urlRegex = /https:\/\/[^/]+/; |
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
| /** | |
| * Extracts the ID from a Google Docs URL. | |
| * | |
| * @param {string} url - The Google Docs URL. | |
| * @returns {string|null} - The extracted ID from the URL, or null if no ID is found. | |
| */ | |
| function getIdFromUrl(url) { | |
| // Use a regular expression to match and extract the ID from the URL | |
| let result = url.match(/[-\w]{25,}(?!.*[-\w]{25,})/); | |
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
| /** | |
| * Checks if a given input is a valid JSON string or an object. | |
| * | |
| * @param {string|object} input - The input to be checked, which can be a JSON string or an object. | |
| * @returns {boolean} - Returns true if the input is a valid JSON string or an object, false otherwise. | |
| */ | |
| function isJSON(input) { | |
| // Check if the input is not a string | |
| if (typeof input !== 'string') { | |
| // Check if the input is already an 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
| /** | |
| * Checks if a given string contains any space character. | |
| * | |
| * @param {string} str - The input string to be checked. | |
| * @throws {Error} Throws an error if the string contains a space. | |
| * @returns {boolean} - Returns true if the string does not contain a space. | |
| */ | |
| function checkForSpace(str) { | |
| // Check if the string includes a space character | |
| if (str.includes(' ')) { |
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
| /** | |
| * Returns the first five characters followed by an ellipsis (...) and the last five characters of a given string. | |
| * If the string length is less than or equal to 10, the original string is returned. | |
| * | |
| * @param {string} str - The input string. | |
| * @returns {string} - The modified string with the first and last five characters, separated by an ellipsis. | |
| */ | |
| function showFirstAndLastFive(str) { | |
| // Check if the string length is less than or equal to 10 | |
| if (str.length <= 10) { |
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 - callLibraryFunction | |
| // based on function documented on | |
| // https://stackoverflow.com/questions/48928932/call-library-function-from-html-with-google-script-run | |
| // with some enhancements for my usecase. | |
| // | |
| function callLibraryFunction(functionPathAndName, ...args){ | |
| let fnPathArray = functionPathAndName.split("."); | |
| let fnPathLength = fnPathArray.length | |
| let libFunc = fnPathArray[fnPathArray.length - 1]; |
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
| # ██████╗ ███████╗███╗ ███╗ ██████╗ ██╗ ██╗███████╗ ██╗ ██╗██████╗ | |
| # ██╔══██╗██╔════╝████╗ ████║██╔═══██╗██║ ██║██╔════╝ ██║ ██║██╔══██╗ | |
| # ██████╔╝█████╗ ██╔████╔██║██║ ██║██║ ██║█████╗ ███████║██████╔╝ | |
| # ██╔══██╗██╔══╝ ██║╚██╔╝██║██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██║██╔═══╝ | |
| # ██║ ██║███████╗██║ ╚═╝ ██║╚██████╔╝ ╚████╔╝ ███████╗ ██║ ██║██║ | |
| # ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚══════╝ ╚═╝ ╚═╝╚═╝ | |
| # | |
| # ██████╗ ██╗ ██████╗ █████╗ ████████╗██╗ ██╗ █████╗ ██████╗ ███████╗ | |
| # ██╔══██╗██║ ██╔═══██╗██╔══██╗╚══██╔══╝██║ ██║██╔══██╗██╔══██╗██╔════╝ | |
| # ██████╔╝██║ ██║ ██║███████║ ██║ ██║ █╗ ██║███████║██████╔╝█████╗ |
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
| BEGIN:VCALENDAR | |
| VERSION:2.0 | |
| PRODID:-//ical.marudot.com//iCal Event Maker | |
| CALSCALE:GREGORIAN | |
| BEGIN:VEVENT | |
| DTSTAMP:20221104T170057Z | |
| UID:[email protected] | |
| DTSTART:20221108T083000Z | |
| DTEND:20221108T090000Z | |
| SUMMARY:Arrive |
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
| // original: https://stackoverflow.com/questions/9905533/convert-excel-column-alphabet-e-g-aa-to-number-e-g-25 | |
| // updated: https://gist.github.com/mark05e/29bb2b7564460059da6d3e74f08ab31f | |
| function find(value, range) { | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| var sheet = range.split("!")[0]; | |
| var A1Ref = range.split("!")[1]; | |
| var [cellStart, cellEnd] = A1Ref.split(":") | |
| var rowStartNumber = Number(cellStart.replace(/[^0-9]/g,'')) | |
| var rowEndNumber = Number(cellEnd.replace(/[^0-9]/g,'')) |