简体   繁体   English

如何在Google Spreadsheets中添加按钮,以便一个人只能单击一次?

[英]How can I add a button in Google Spreadsheets so that one person can click it only once?

I'm looking for any changes in app script that will make this happen. 我正在寻找可以实现此目的的应用程序脚本中的任何更改。 I've already made a button and assigned the correct function to it. 我已经做了一个按钮,并为其分配了正确的功能。

You can use PropertiesService to store user specific data. 您可以使用PropertiesService来存储用户特定的数据。

    var properties = PropertiesService.getUserProperties();
    var buttonStatus = properties.getProperty("buttonStatus");

      if(!buttonStatus){

          //code to be executed after clicking the button

          properties.setProperty("buttonStatus", "clicked");
          return;

      }

      //code to be executed when user clicks the button multiple times (e.g. displaying notification)

      return;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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