Thanks Eric I will try that On Aug 23, 2016 10:06 PM, "'Eric Koleda' via Google Spreadsheets API" < [email protected]> wrote:
> The code looks good, you just need to find another way to run it. Custom > functions are used to calculate values, not to alter the spreadsheet. You > can use the run menu in the script editor UI to run it, or add a custom > menu to your spreadsheet: > > https://developers.google.com/apps-script/guides/menus > > - Eric > > On Tuesday, August 23, 2016 at 5:31:21 AM UTC-4, bolleypally vijay kumar > wrote: >> >> >> 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.getActiveSpread >> sheet().getNumSheets(); >> for(var i = 1; i <= totalSheetsCount; i++) { >> var eachSheet = SpreadsheetApp.getActiveSpread >> sheet().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 a topic in the > Google Groups "Google Spreadsheets API" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/google-spreadsheets-api/Cx0WZ_MAvmI/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- 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.
