When adding menu items to a spreadsheet using spreadsheet.addMenu()
is there a way to make them tickable like the item View>Normal?
相关问题
- How can I force all files in a folder to be owned
- Google Apps Script: testing doPost() with cURL
- Google Apps Script to turn in, grade, and return a
- Script fails on SpreadsheetApp.openById - Requires
- Split Lines and Bold Text within a ui.alert Window
相关文章
- How to allow access for importrange function via a
- Google app script trigger not working
- Set Date/Time to 00:00:00
- indexOf returning -1 despite object being in the a
- Using MIN() inside ARRAYFORMULA()
- How can my Google Apps Script be run by others the
- Google Spreadsheet COUNTIF formula equivalent with
- In Google Sheets how to reference infinite rows in
I tried using the answer @KalyanReddy provided, but ran into a problem because the spreadsheet UI compresses spaces and trims menu names. By trial and error, I found a work-around.
Here's a utility function that generates checkbox-aligned menus:
To make real use of this, you should write a single function that tracks the state of and builds your menu items by calling buildItemName, then call it &
updateMenu()
whenever state changes.If you really wanted to do it, maybe you can do something clunky like the following and call
updateMenu
to add a check mark whenever necessary.The short answer is no.
The long(er) answer is that menu items can only call functions so there is no use for it to show a 'state'. Nevertheless you could imagine to use some kind of header in the spreadsheet itself that shows the state you want to show, either by modifying a text value or by changing a color to show that some function has been called.
I'm supposing that the final goal of your request is to show if a function has been called or not... If I'm wrong then please explain was was your intention.