Hy, Everyone .. I have a question about creating the menu in GAS (Google Apps Scripts) to implement to a Google Spreadsheet without a three of the scripts which is has been take long long way and take my energy too and many many so many lines of the scripts like this I have created. This is the script. Here's the code :
function Menu1() {
var ui = s.getUi(),
s = SpreadsheetApp,
ss = s.getAcgtiveSpreadsheet(),
sss = ss.getSheets(),
madeMenu = ui.createMenu('Sheet Tools Just For an Example Menus');
for (var i=0; i < sss.length; i++){
madeMenu.addSubMenu(ui.createMenu(sss[i].getName())
.addItem('Go to ...', 'S'+i+'GoToS')
.addItem('Rename ...', 'S'+i+'RenameS')
.addItem('Move ...', 'S'+i+'MoveS'))
madeMenu.addToUi();
}
}
function GoToS(getSheetNumber) {
var sheet = sss[getSheetNumber];
ss.setActiveSheet(sheet);
}
This of the main of my problems cames to !!! Because these structures of the scripts and then so to make me had to create this lines. See at the below :
function S0GoToS() {
GoToS(0)
}
function S1GoToS() {
GoToS(1)
}
function S2GoToS() {
GoToS(2)
}
function S3GoToS() {
GoToS(3)
}
function S4GoToS() {
GoToS(4)
}
function S5GoToS() {
GoToS(5)
}
The question is How to create them without the third-sub of the scripts ??? I thought and I hope there is the another way to create these for sure yes I believe there is but that just the because I don't know how about that way. Please someone chould be can help me to solve this case. Any achieves will be appreciated. Thanks in advance has taken in your time and I appologies for my poor english.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…