将取消隐藏选项卡限制为某些用户 [英] Restrict unhiding tabs to certain users

查看:52
本文介绍了将取消隐藏选项卡限制为某些用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Google电子表格中的保护工作表/范围功能,但是我想做的是完全向某些用户隐藏工作表.我已经找到了下面的代码对此的答案.打开电子表格后,我可以自动将某些标签/表格隐藏给指定的用户,但这并不能阻止他们再次取消隐藏标签/表格.有什么建议可以限制他们取消隐藏这些标签吗?

I am aware of the protect sheet/range function in google spreadsheet but what I want to do is to hide sheets completely from certain users. I have found an answer to this with the code below. I am able to hide certain tabs/sheets to the specified user automatically upon opening the spreadsheet but that doesn't stop them from unhiding the tabs/sheets again. Any recommendations to restrict them from unhiding those tabs?

function onOpen() {
  var adminUsers = ['sample@google.com'];
  var Users = ['sample@gmail.com'];

  if (adminUsers.indexOf(Session.getEffectiveUser().getEmail()) >= 0) {
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName('SETTINGS').showSheet();
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName('INSTRUCTION').showSheet();
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName('EMPLOYEES').showSheet();
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName('LEAVE').showSheet();
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName('TEAM DASHBOARD').showSheet();
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName('EMS').showSheet();
  }

  if (Users.indexOf(Session.getEffectiveUser().getEmail()) >= 0) {
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName('SETTINGS').hideSheet();
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName('EMPLOYEES').hideSheet();
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName('LEAVE').hideSheet();
    SpreadsheetApp.getActiveSpreadsheet().getSheetByName('EMS').hideSheet();

    }
}

推荐答案

查看者无法对Google表格电子表格进行任何更改.为了防止查看者进行复制以访问隐藏的工作表和行,请阻止要打印/复制/下载的电子表格.有关详细信息,请参见停止,限制或更改共享.

Viewers can't make any change to Google Sheet spreadsheets. In order to prevent that a viewer make a copy to get access to hidden sheets and rows, block the spreadsheet to be printed/copied/downloaded. For details see Stop, limit, or change sharing.

值得注意的是,隐藏或显示工作表将使其对正在查看电子表格的所有用户有效.

It's worth to note that hiding or showing a sheet will make it effective to all users who are viewing the spreadsheet.

这篇关于将取消隐藏选项卡限制为某些用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆