是否可以使用一个小脚本重新排列工作表标签的顺序,将当前选定的工作表标签移动到Google电子表格中所有标签的最左侧(开头)?
答案 0 :(得分:2)
function BacktotheFront() {
SpreadsheetApp.getActiveSpreadsheet().moveActiveSheet(1);
}
答案 1 :(得分:1)
是和否。可以通过甜蜜名称来完成,但不能通过您正在查看的当前表单来完成。下面是我写的一些代码,它每天都会将甜蜜转移到第一个位置。
function tab() {
var reportDate = new Date();
var tabName = Utilities.formatDate(reportDate, 'MST', 'yyyy-MM-dd').toString();
var tab = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(tabName);
SpreadsheetApp.setActiveSheet(tab);
SpreadsheetApp.getActiveSpreadsheet().moveActiveSheet(1);
}
答案 2 :(得分:1)
这会在名为" Move Tabs"的菜单中添加两个菜单项。这会将当前标签移动到最左侧或最右侧。
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Move Tabs')
.addItem('Move Current Sheet To Far Left', 'moveCurrentToFarLeft')
.addItem('Move Current Sheet To Far Right', 'moveCurrentToFarRight')
.addToUi();
}
function moveCurrentToFarRight() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheets = spreadsheet.getSheets();
spreadsheet.moveActiveSheet(sheets.length);
}
function moveCurrentToFarLeft() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
spreadsheet.moveActiveSheet(1);
}