Reputation: 119
I have a spreadsheet where I'm trying to hide two tabs:
function mySheet() {
// lots of stuff
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Raw Data").showSheet();
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Raw Data").hideSheet();
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Template").showSheet();
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Template").hideSheet();
}
Weirdly, "Template" gets hidden but "Raw Data" doesn't. I added the showSheet() method based on an answer to another question but it didn't make any difference.
What could be causing the hideSheet() method to not work? I checked spelling. The "Raw Data" sheet is active at times during the script execution and should be hidden at the end of the function call to mySheet().
Thanks for any thoughts!
Upvotes: 0
Views: 81
Reputation: 64042
This works for me
function mySheet() {
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet0").showSheet();
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet0").hideSheet();
}
Upvotes: 1