I want to share the sheet with others but i also want them to not able to see some columns. Is there any way out to solve this using google apps script or if any alternate option for the same. Thank you.
4 Answers
You should take a look at the documentation, it will help you to find the function you're looking for. In this case, you need the Sheet.hideColumns(columnIndex) method
hideColumns(columnIndex)
Hides the column at the given index.
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; // Hides the first column sheet.hideColumns(1); 1 Comment
SIDMISH
Thanks, actually i read somewhere on article saying you can not hide columns using google aaps script, so without even checking the documentation thoroughly i asked here. Sorry my bad !.
Very simple function function onOpen(){ ss = SpreadsheetApp.openById( 'sheetid' ), sheet = ss.getSheetByName('sheet_name'), ss.getActiveCell(); sheet.hideColumns(start_column_number, end_column_number); } 2 Comments
technogeek1995
Welcome to SO! You should add some additional explanation to your code to create a more robust answer. If you need additional help, check out how to answer.
Juuso Nykänen
Your answer is off. Should be:
sheet.hideColumns(start_column_number, number_of_columns)