我已经编写了一个基本函数,可以将一个工作表(选项卡(从一个Google工作表复制到另一个,并根据一个特定单元格的内容对其进行重命名。然而,单元格在源文档中被格式化为日期,所以当我希望在目标文档中有一个名为"的新选项卡时;7/4";,我得到了";2021年7月4日星期日21:00:00 GMT-0700(PDT(";。有没有一种方法可以在标签出现在屏幕上时提取用于命名的单元格值?(即M/DD格式(?
function menuItem3() {
// copy data from Google Sheet A to Google Sheet B
var source = SpreadsheetApp.getActiveSpreadsheet();
var destination = SpreadsheetApp.openById('destination_ID'); //sets specified spreadsheet as destination
var sheet = source.getSheets()[0];
var cell = sheet.getRange("A13");
var value = cell.getValue();
sheet.copyTo(destination).setName(value); //copies the sheet to destination and renames
}
感谢
function menuItem3() {
// copy data from Google Sheet A to Google Sheet B
var source = SpreadsheetApp.getActiveSpreadsheet();
var destination = SpreadsheetApp.openById('destination_ID'); //sets specified spreadsheet as destination
var sheet = source.getSheets()[0];
var cell = sheet.getRange("A13");
var value = cell.getDisplayValue();//edit
sheet.copyTo(destination).setName(value); //copies the sheet to destination and renames
}