I have a Spreadsheet with 15 sheets i would like to freeze first 2 rows of 
each sheet using code in .js file that is associated with my spreadsheet 

Code i wrote in .gs file

function freezesColumns(){
var totalSheetsCount = SpreadsheetApp.getActiveSpreadsheet().getNumSheets();
   for(var i = 1; i <= totalSheetsCount; i++) {
     var eachSheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[i];
     eachSheet.setFrozenRows(2);
   }
}

and called this method in any cell i the spreadsheet =freezesColumns()

Error Details:No Permission to call setFrozenRows(line no in .gs file)

<https://lh3.googleusercontent.com/-gHpGa635MAo/V7wVsxZc6rI/AAAAAAAAB44/pNsSdX13W7cSgfL57Rm6u97RyJcH8iG3gCLcB/s1600/GSS.png>


In my case number of sheets will increase every time and i want to make 
specific rows and columns freeze automatically with code.


i also refereed Custom Functions in Spreadsheets 
<https://developers.google.com/apps-script/execution_custom_functions?hl=fr-FR> 
documentation 
and got "*Custom functions cannot set values outside the cells they are 
in" **if its true how to use 'setFrozenRows' and 'setFrozenColumns' in API*

Please help me make it possible

-- 
You received this message because you are subscribed to the Google Groups 
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to