title: Optimize Google Script for Hiding Columns
body: <p>These two scripts are incredibly slow. I work with a data set of about 32 columns by 1000 rows ( growing pretty rapidly ).</p>
  
  <p>I've read and even used code for treating data like an array so that you can make only one call to google-services, but I'm not sure how that can help me with this case.</p>
  
  <p>I need to hide certain columns depending on which person is using the google sheet</p>
  
  <p>Here is the actual code:</p>
  
  <pre><code>function HideColumns(){
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getActiveSheet();
    var range = sheet.getRange("A1");
    sheet.hideColumn(range);
    range = sheet.getRange("C1:E1");
    sheet.hideColumn(range);
    range = sheet.getRange("G1");
    sheet.hideColumn(range);
    range = sheet.getRange("I1");
    sheet.hideColumn(range);
    range = sheet.getRange("K1");
    sheet.hideColumn(range);
    range = sheet.getRange("Q1:Z1");
    sheet.hideColumn(range);
    range = sheet.getRange("AC1:AG1");
    sheet.hideColumn(range);
  }
  
  function ShowColumns(){
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getActiveSheet();
    var range = sheet.getRange("A1");      
    sheet.unhideColumn(range);
    range = sheet.getRange("C1:E1");
    sheet.unhideColumn(range);
    range = sheet.getRange("G1");
    sheet.unhideColumn(range);
    range = sheet.getRange("I1");
    sheet.unhideColumn(range);
    range = sheet.getRange("K1");
    sheet.unhideColumn(range);
    range = sheet.getRange("Q1:Z1");
    sheet.unhideColumn(range);
    range = sheet.getRange("AC1:AG1");
    sheet.unhideColumn(range);
  }
  </code></pre>