简体   繁体   中英

Active all sheets of a spreadsheet using Google Apps Script

I would like to activate all hiden sheets by using google app script.

I tried:

SpreadsheetApp.getActiveSpreadsheet().getSheetByName(„xxx“ &&“yyy“).activate ();

And i try it also for every sheet separate

Explanation:

I assume you mean you want to unhide all the sheets.

  • You can use showSheet() for every sheet since this function has no effect on a sheet that is already visible.

  • Use getSheets() to get all the sheets and then forEach to unhide every sheet in the spreadsheet file.

Solution:

function unhideAllSheets() {
   SpreadsheetApp.getActive().getSheets().forEach(sh=>sh.showSheet()); 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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