javascript - Create a new sheet in a Google Spreadsheet with Google Apps Script -


how create new sheet in google spreadsheet google apps script?

i know seems obvious want create new sheet specific name.

surprisingly didn't find clear , quick answer.

so here code:

function onopen() {     var activespreadsheet = spreadsheetapp.getactivespreadsheet();     var yournewsheet = activespreadsheet.getsheetbyname("name of new sheet");      if (yournewsheet != null) {         activespreadsheet.deletesheet(yournewsheet);     }      yournewsheet = activespreadsheet.insertsheet();     yournewsheet.setname("name of new sheet"); } 

finally, note new sheet automatically active one.


Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -