Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I have a Google spreadsheet with my monthly balance sheet for my company. I keep track of estimated and actual like this:

Expense | Jan11 Actual | Jan11 Estimate | Dec10 Actual | Dec10 Estimate | etc...

I would love it if I could easily hide all the Estimate columns with a touch of a button, and turn them on with another touch.

How can I do this?

share|improve this question
add comment

1 Answer 1

Google Apps Script can do it.

This should get you started:

function onOpen() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var menuEntries = [ {name: "Hide", functionName: "myFunction"} ];
  ss.addMenu("Scripts", menuEntries);
}

function myFunction() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var colCount = sheet.getMaxColumns();
  var x;
  for ( x = 1; x < colCount; x = x + 2) {
    var r = sheet.getRange(1,x);
    sheet.hideColumn(r);
  }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.