title: Google Sheet Conditional HideColumn() & ShowColumn()
body: <p>Appreciate if someone can help me out with this chunk of codes. What I am trying to achieve (step by step) is:</p>
  
  <ol>
  <li>If Checkbox in Cell "A7" is checked in Sheet1</li>
  <li>Column "P" will be automatically be unhidden in Sheet2</li>
  <li>Else if Checkbox in Cell "A7" is unchecked in Sheet 1</li>
  <li>Column "P" will be automatically be hidden in Sheet2</li>
  </ol>
  
  <p>This is my 1st time doing coding....really grateful if a kind soul can help. Thanks.</p>
  
  <pre><code>function showHide() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet1 = ss.getSheetByName("sheet1");
    var sheet2 = ss.getSheetByName("sheet2");
    var vtrue = "TRUE"
    var vfalse = "FALSE"
  
    sheet1.getRange('A7').activate();
  
    if (sheet1.getRange('A7').getValue() == vtrue)  {
      sheet2.showColumns(sheet2.getRange("P:AA"));  
    } else if (sheet1.getRange('A7').getValue() == vfalse)   {
      sheet2.hideColumns(sheet2.getRange("P:AA"));
    }       
  }
  </code></pre>
  
  <p>Thanks a million.</p>
  
  <p>Cheers.</p>