问题描述
我正在使用脚本管理Google电子表格. onEdit正常工作-我可以通过将
I'm managing a Google spreadsheet with a script. onEdit is working - I can colour a cell red by putting
SpreadsheetApp.getActiveRange().setBackgroundRGB(255, 0, 0);
在onEdit函数中.我想将相同的代码放在onClick函数中,以便当用户单击单元格时,它立即变为红色.这可能吗?我在文档中找不到任何方法.
in the onEdit function. I would like to put the same code in a onClick function, so that when a user clicks on a cell it immediately turns red. Is this possible? I can't find any way to do it in the documentation.
推荐答案
您可以更进一步....使用诸如完成"之类的选项为单元格创建一个验证.点击下拉菜单,选择完成.现在创建要触发的onChange或onEdit触发器.您可以获得单元格/范围的上下文相关函数....例如在行或列上触发.这很容易复制和编程
You can get closer....Create a validation for the cells with an option...like "Done". Click the dropdown, select Done. now create a trigger onChange or onEdit to fire. You can get a cell/range contextualized function....like firing on a row or column. This is easy to replicate and program for
这篇关于如何在电子表格的Google Apps脚本中监视点击事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!