简体   繁体   中英

call script based on onedit / google sheets

I'm looking to launch a script based on an edit on a specific sheet/cell.

Lets say when Sheet 'Scripts' cell A1 = 'Phone Script'

This function launches:

   var formTitle = 'Phone Script';
   var formID = 'My Form ID';
   var form = FormApp.openById(formID);
   var formUrl = form.getPublishedUrl();
   var htmlApp = HtmlService
   .createHtmlOutput('<script>location.href = "' + formUrl + '"</script>')
   .setSandboxMode(HtmlService.SandboxMode.IFRAME)
   .setTitle(formTitle)
   .setWidth(500) 
   .setHeight(450);
   SpreadsheetApp.getActiveSpreadsheet().show(htmlApp);`

I originally had this assigned to a button but I'd like to move off of that.

 function onEditSend850(e) {
 if(e.range.getA1Notation() !== 'C1' || e.value !== 'Send 850') return;
 emailandsave850()
 }

on edit trigger, when c1 reads Send 850 it will run function emailandsave850

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM