How do I Hide a sheet?

浪尽此生 提交于 2019-12-06 14:08:53

sheet.hidesheet()

It's been added.

I too am looking for that same answer. As far as I can tell SpreadsheetApp, Spreadsheet and Sheet classes dont have any Hide/Unhide methods. However I use the following code to set sheet protection on all sheets in a spreadsheet, to iterate through all sheets and protect them, same could be applied to Hide/UnHide if it is supported.

function protectSheets() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var num_sheets = ss.getNumSheets();
for (var i = 0; i < num_sheets; i++){
  SpreadsheetApp.setActiveSheet(ss.getSheets()[i]);
  var sheet = SpreadsheetApp.getActiveSheet();
  var permissions = sheet.getSheetProtection();
  permissions.setProtected(true);
  sheet.setSheetProtection(permissions);
};
}

Will you need hide the pages of g.sheet after you access they using buttons in main page of menu to access to other pages which you want to hide? if that is your problem you should resolve using a simple coding, make one button per page to back to your main page, to the others page always keep hidden, just to the main not keep, for this, use the follow content:

function menu() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var pagetohide = sheet; var menu = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('menu'); SpreadsheetApp.setActiveSheet(menu); pagetohide.hideSheet();

I hope helped you, sorry per my english.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!