In my google spreadsheet i created a script (below) which give me the function/formula to get the name of the sheet/tab which i am currently in.
The problem is when i change the sheet name to a new name then this cell is not updating with the new name even after several refresh.
I have set triggers to run the script as well as i have used SpreadsheetApp.flush() to forcefully applies all pending Spreadsheet changes, but still this does not work.
This is my script below:
function sheetname() {
 var ss = SpreadsheetApp.getActiveSpreadsheet();
 var s = ss.getActiveRange().getSheet();
   return s.getName();
}
And this is with the flush :
function sheetname() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = ss.getActiveRange().getSheet();
   SpreadsheetApp.flush();
   return s.getName();
 }
Please let me know what changes i need to make so that this can update as and when the sheet name is changed.
 
     
    