I need to hide and show in a easy way a group of columns in Google Sheets.
In Excel I used a Macro with a button, but in Sheets I cannot put a button.
How can I add buttons with custom functions in Google Sheets?
google sheets
I need to hide and show in a easy way a group of columns in Google Sheets.
In Excel I used a Macro with a button, but in Sheets I cannot put a button.
How can I add buttons with custom functions in Google Sheets?
Best Answer
It is possible to assign a function to a button in Google Spreadsheets, but in practice it's easier to add commands to the spreadsheet menu. This way you do not have to look for them in the spreadsheet, and they do not get in the way of your data.
Suppose you want custom commands "show/hide columns B-D, G". Create and save the following script in (Tools->Script Editor):
Next time you open this spreadsheet, it will have "Custom" menu option with two commands, for showing and hiding this range of columns.
If you still want to trigger scripts by an embedded element in the sheet, see this illustrated example.