I am trying to create a custom side menu that changes depending on what sheet I am on so the side menu is relevant to what I am on.
I've attempted doing some code to do a tactic where depending on what sheet I am on, the script will choose the correct html file I want it to use.
My issue is with my attempt on function SidebarChooser(), where I've looked at if query's and I can't see what is wrong with mine? (I do intend to add more IF's depending on what you say/advise me to do)
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Sidebar').addItem('Open', 'openSidebar').addToUi();
}
function SidebarChooser() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
var sheet = SpreadsheetApp.getActiveSheet()
var html = HtmlService.createHtmlOutputFromFile('sidebar');
if (sheet == '1') {
SpreadsheetApp.getUi().showSidebar(html);
}
}
function openSidebar() {
var html = HtmlService.createHtmlOutputFromFile('sidebar');
SpreadsheetApp.getUi().showSidebar(html);
}
function Warehouse(){
var ss=SpreadsheetApp.getActiveSpreadsheet()
var s=ss.getSheetByName("GoodsInPlus")
var row=s.getActiveCell().getRow()
var column=1
s.getRange(row, column).activate()
}
function order(){
var ss=SpreadsheetApp.getActiveSpreadsheet()
var s=ss.getSheetByName("2")
var row=s.getActiveCell().getRow()
var column=1
s.getRange(row, column).activate()
}
function stu(){
var ss=SpreadsheetApp.getActiveSpreadsheet()
var s=ss.getSheetByName("UI idea")
var row=s.getActiveCell().getRow()
var column=1
s.getRange(row, column).activate()
}
function merlin(){
var ss=SpreadsheetApp.getActiveSpreadsheet()
var s=ss.getSheetByName("Sheet9")
var row=s.getActiveCell().getRow()
var column=1
s.getRange(row, column).activate()
}
function enterName(name){
var ss = SpreadsheetApp.getActive()
var sheet = ss.getSheetByName('1')
sheet.getRange("A3").setValue(name)
}
function enterClient(client){
var ss = SpreadsheetApp.getActive()
var sheet = ss.getSheetByName('1')
sheet.getRange("E3").setValue(client)
}