title: Renaming a file in google sheet to previous month name using script
body: <p>I want to create a backup sheet of  a google sheet file and its name should be "previous month name + year". Backup file is created, renaming the file is not happening.</p>
  
  <pre><code>function Copy() {
  var sss = 
  SpreadsheetApp.openById('1IK6YsZS3_NNAlFA41d8uKriPzfZs_2Ukyh94eeBFj40'); 
  var ss = sss.getSheetByName('CURRENT'); 
  var range = ss.getRange('A1:H45'); 
  var data = range.getValues();
  
  var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var yourNewSheet = activeSpreadsheet.getSheetByName("prevMonth");
  
  if (yourNewSheet != null) 
  {
      activeSpreadsheet.deleteSheet(yourNewSheet);
  }
  
  yourNewSheet = activeSpreadsheet.insertSheet();
  yourNewSheet.setName("prevMonth");
  yourNewSheet.getRange(yourNewSheet.getLastRow()+1,1,45,8).setValues(data);
  }
  </code></pre>