1
votes

I have created a sheet template in google sheets which I am using quite a lot. Unfortunately I often forget to change the spreadsheet name after filling the sheet with the required data. So in Drive I am ending up with a lot of sheets having the same name. The solution would be to use the content of a cell to automatically give a name to the file.

I have been trying to find a solution but everything I discovered was how to change the sheet(tab) name not the spreadsheet (file) name itself. Is there a way to do this?

1

1 Answers

0
votes

You should be able to use an attached script like this: (also below where it says sheetnamegoes here- this is the sheet in the current spreadsheet that you have added the doc title. Often times it is default sheet1

function onOpen(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var first = ss.getSheetByName("YOURSHEETNAMEGOESHERE");
  ss.rename(first.getRange(2, 3).getValue());
  // this would change the name to whatever is in Row 3, col 2
}