I'm trying to create a generic timesheet for my school project. I created a simple function to get the name of the active sheet.
function SetSheetName() {
var Sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
return Sheet.getName();
}
It works just fine the first time I use it. But if I change the name of the sheet and re-call the function, it stills fetch the old name of the sheet.
For example, if the name of the sheet was "Sheet1" and I run the function in a cell, the cell value will be Sheet1. But if I change the name of the same sheet and re-call the function, I will still get Sheet1 no matter what.
I guess it's the way google docs functions, but I am not aware how to fix that problem.