按钮单击仅适用于 Windows &不适用于 Android 手机工作表

按钮单击仅适用于 Windows &不适用于 Android 手机工作表

问题描述:

我在 Google 电子表格中创建了一个图像按钮并分配了功能,以执行某些操作.但是此按钮单击仅适用于 Windows,不适用于 Android 移动工作表或移动浏览器.此问题的解决方法是什么?

I have created an image button in Google spreadsheet and have assigned function, to perform some action. But this button click is only working on windows and not working on Android mobile sheet or mobile browser. what is a workaround for this issue?

解决方法是使用复选框(比如在 F1 中)而不是按钮/图像.然后挂钩您的函数,该函数应该在按钮单击时运行到 onEdit() 函数.

Workaround is to use checkboxes(say, in F1) instead of buttons/Images. Then hook your function, that is supposed to run on button click to onEdit() function.

function onEdit(e){
  const rg = e.range;
  if(rg.getA1Notation() === "F1" && rg.isChecked() && rg.getSheet().getName() === "Sheet1"){
    callFunctionAttachedToImage();
    rg.uncheck();
  }
}

参考: