google-apps-script

JDBC/mysql Connection string issues from Google App Script

时光毁灭记忆、已成空白 提交于 2020-05-01 08:10:30
问题 I have the following code used to connect to a mySQL server from a Google App Script. It was working prior to moving the server. Now, even though I have entered the new information(address, names, pasword), it no longer works. The error I am getting it "failed to establish a database connection. Check connection string, username and password." I am not familiar with servers and need to figure out how to fix this. I have Putty, but am unfamiliar with it - I tried, but it still would not

Disable or reset the Execution Transcript in Google Apps Script

…衆ロ難τιáo~ 提交于 2020-04-30 13:58:23
问题 Is it possible to disable or reset the Execution Transcript in Google Apps Script? If not, what would be the best way to run a script that requires sensitive access tokens for API calls? 回答1: Use a time-based trigger to invoke a simple dummy script: function clearIt() { Logger.log("hi"); } This script could be invoked every minute, or specifically invoked via one-time trigger to occur after specific other functions. If you go the one-time route you'll need to delete the invoking trigger to

Throw custom timeout exception

江枫思渺然 提交于 2020-04-30 11:44:25
问题 I have a Google Apps Script web app ("Web App") that executes as the user, then calls individual functions from another Apps Script project ("API Executable") via the Apps Script API using UrlFetchApp.fetch() and executes them as me (see Get user info when someone runs Google Apps Script web app as me). A limitation of this method is that UrlFetchApp.fetch() has a 60s timeout, and one of my functions often takes longer than this. The API Executable function finishes running successfully, but

Throw custom timeout exception

只谈情不闲聊 提交于 2020-04-30 11:44:00
问题 I have a Google Apps Script web app ("Web App") that executes as the user, then calls individual functions from another Apps Script project ("API Executable") via the Apps Script API using UrlFetchApp.fetch() and executes them as me (see Get user info when someone runs Google Apps Script web app as me). A limitation of this method is that UrlFetchApp.fetch() has a 60s timeout, and one of my functions often takes longer than this. The API Executable function finishes running successfully, but

2 Time triggers - Google app scripts

谁说我不能喝 提交于 2020-04-30 09:28:49
问题 i looked at the google app script installable trigger docs online (https://developers.google.com/apps-script/support) , and one of the examples shows how 2 create 2 time triggers. function createTimeDrivenTriggers() { // Trigger every 6 hours. ScriptApp.newTrigger('myFunction') .timeBased() .everyHours(6) .create(); // Trigger every Monday at 09:00. ScriptApp.newTrigger('myFunction') .timeBased() .onWeekDay(ScriptApp.WeekDay.MONDAY) .atHour(9) .create(); } My code: function

2 Time triggers - Google app scripts

白昼怎懂夜的黑 提交于 2020-04-30 09:27:21
问题 i looked at the google app script installable trigger docs online (https://developers.google.com/apps-script/support) , and one of the examples shows how 2 create 2 time triggers. function createTimeDrivenTriggers() { // Trigger every 6 hours. ScriptApp.newTrigger('myFunction') .timeBased() .everyHours(6) .create(); // Trigger every Monday at 09:00. ScriptApp.newTrigger('myFunction') .timeBased() .onWeekDay(ScriptApp.WeekDay.MONDAY) .atHour(9) .create(); } My code: function

Formatting phone number in place in sheet cell

假装没事ソ 提交于 2020-04-30 09:23:28
问题 I'm working with google sheets and would like to convert US phone numbers to the format: 1xxxyyyzzzz eg 402-333-4444 should be turned into 14023334444 I have an apps script validator function which does this: var numbers = 'INVALID' if ( parsed_body.hasOwnProperty('PHONE') ) { var phone = parsed_body['PHONE'].toString(); Logger.log(parsed_body); numbers = phone.replace(/[^0-9]/g, ""); var firstChar = numbers.charAt(0); if ( firstChar !== '1'){ numbers = '1'+ numbers} Logger.log(numbers); if (

Google Apps Script HTML Form

做~自己de王妃 提交于 2020-04-30 09:10:46
问题 I have a simple html form with email sending this is the html file: <!DOCTYPE html> <html> <head> <base target="_top"> <script> function submitForm() { var name = document.getElementById('name').value; var email = document.getElementById('email').value; var comment = document.getElementById('comment').value; /** * First run submitData(name, email, comment) function of Code.gs * Then, run showMessage(value) function of this html file */ google.script.run .withSuccessHandler(showMessage) //

Google Apps Script HTML Form

梦想与她 提交于 2020-04-30 09:10:44
问题 I have a simple html form with email sending this is the html file: <!DOCTYPE html> <html> <head> <base target="_top"> <script> function submitForm() { var name = document.getElementById('name').value; var email = document.getElementById('email').value; var comment = document.getElementById('comment').value; /** * First run submitData(name, email, comment) function of Code.gs * Then, run showMessage(value) function of this html file */ google.script.run .withSuccessHandler(showMessage) //

How to set values in new column with validation from a Named Range?

霸气de小男生 提交于 2020-04-30 08:47:38
问题 Following a previous question I want to classify text entries by adding a tag in the next column. I could do it using regex but it will take too much time writing all conditions like : if(String(data[i][0]).match(/acme|brooshire|dillons|target|heb|costco/gi)) { labValues[i][0]='Supermarket'; } Instead I created a named list with all stores names (in another sheet). If an entry matches a term in the list, the next column is set to " Supermarket ". I am using this script below... No bugs but