我是谷歌脚本的新手,我需要将当前活动工作表复制到新工作表,然后根据单元格值重命名此工作表.我的问题是单元格值是一个日期和下面的代码工作,而是重新命名工作表2014年5月30日它返回数字等效41789.我如何粘贴实际日期.
function CreateNewTimesheet() {
// The code below makes a duplicate of the active sheet
var ss = SpreadsheetApp.getActiveSpreadsheet()
SpreadsheetApp.getActiveSpreadsheet().duplicateActiveSheet();
// The code below will rename the active sheet to Month End date based on cell O3
var myValue = SpreadsheetApp.getActiveSheet( ).getRange("O3").getValue();
SpreadsheetApp.getActiveSpreadsheet().renameActiveSheet(myValue);
}
Run Code Online (Sandbox Code Playgroud)