到目前为止,我在谷歌脚本编辑器中有两个功能 - 第一个工作,第二个不工作。
function HideColumn() //trigger is set to open
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getSheetByName("Sheet 1");
var datarange = s.hideColumns(34); //this will hide Column AH
}
function unHideColumn() //trigger is set to edit
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Sheet 1");
var range = sheet.getRange("AG2");
{
if (range === ("14. Ineliglble")) sheet.unhideColumn("AH");
}
}
链接到工作表:https://docs.google.com/spreadsheets/d/1DJTmKqaiYWdeoNxTWIawTE-nzI_mcIdbq9VEiCJz6OM/edit?usp=sharing
答案 0 :(得分:0)
==
或===
而不是=
。请参阅https://developer.mozilla.org/en/docs/Web/JavaScript/Equality_comparisons_and_sameness