About your situation, there is a thread. In this thread, Rubén says that
This is a known limitation of onEdit.
About the direct solution of this issue, it is required to wait for Google's update.
Here, I would like to think of a workaround for your situation. The flow of this workaround is as follows.
This workaround supposes that there are the checkboxes in the range of "F1:F20".
- Check whether the edited range is in "F1:F20".
- If the edited range is in "F1:F20", retrieve values of "F1:F20" and check each value.
- Create an array for putting the result.
- Overwite the created array to "F1:F20".
By this, although it might be not perfect, it can be artificially achieved. Please think of this as just one of several workarounds.
Sample script:
function onEdit(e){
if (e.range.columnStart == 6 && e.range.columnEnd == 6 && e.range.rowStart <= 20) {
var ckeckboxRange = "F1:F20";
var date = new Date();
var range = e.source.getRange(ckeckboxRange);
var values = range.getValues().map(function(e) {return e[0] === true ? [date] : [""]});
range.offset(0, 1).setValues(values);
}
}
Result:
Note:
- This is a simple sample script. So please modify this for your situation.
If this was not the result you want, I apologize.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…