将 "password" 类型添加到 Google Apps 脚本输入框

Adding "password" type to Google Apps Script inputBox

是否可以将 "password" 类型分配给 Google Apps 脚本输入框,以便不显示文本?

以下内容运行良好,但输入字段是一个简单的文本框并显示文本而不是“••••••••”:

Browser.inputBox('Please enter your password');

我有一个 Google Sheet 和一个关联的脚本,该脚本会使用从外部 API 检索到的信息自动填充某些单元格。 API 需要简单的身份验证,所以这就是为什么我提示用户输入用户名和密码(这是一个内部工具,所以询问密码没有问题,它没有被存储或任何东西)。

根据 Sandy Good's comment, I ended up using a custom dialog with an HTML service.

以下内容非常适合显示类型为 "password" 的输入并将值传递给我的 google 脚本:

pw_input.html

<script>
  function updateInfo(form) {
    google.script.run.myOtherScript(form.password.value);
    google.script.host.close();
  }
</script>
<form>
  Password:
  <input type="password" name="password">
  <input type="button" value="OK" onclick="updateInfo(this.form)" />
</form>

main.gs

function myMainFunc() {

  onOpen();

  var html = HtmlService.createHtmlOutputFromFile('pw_input')
      .setSandboxMode(HtmlService.SandboxMode.IFRAME);
  SpreadsheetApp.getUi()
      .showModalDialog(html, 'Please enter your password');
};

other_script.gs

function myOtherScript(promptResponse) {
  etc...
};