重新启动谷歌脚本中的触发器

时间:2016-04-21 16:59:18

标签: javascript google-apps-script google-sheets google-spreadsheet-api

我设置了 onEdit 触发器,我希望在另一个函数中重新启动或调用

function onEdit(e) {
 var ss=SpreadsheetApp.getActiveSpreadsheet();
 var chng= e.range;

  ///something set a validation on near cell. showing drip list validation..
}

function tst(){
 /// I put a new item in that validated cell
//then the cell warns me with red triangle saying 'invalid content'

// And i run this function to add that new value to validation list range 
// adding works fine. but the red triangle still there 
//and also validation drop list doesn't show that added item.

//so I want to re-fire or refresh onEdit trigger in this function
//to reset validation and erase that warning.

// so something like this..?
var atv = SpreadsheetApp.getActiveRange();
onEdit.range = atv;  

////no error occurred on sheet 
////but cell warning and validation didn't change.
}

我还尝试在onEdit中拉出函数以便稍后调用验证函数。但现在onEdit不起作用。

我已经更改了触发目标单元格值0并再次返回到trig 并从脚本api中添加了一些休眠时间..但它没有工作

那么..有什么想法吗?

1 个答案:

答案 0 :(得分:0)

添加

print_r(str_split((string) $input));

newbb总是找到答案只是尖端的尖端..; - /

PS。感谢Robin Gertenbach