Remove custom menu from Google Sheets - google-apps-script

I added a menu into my Google Sheets but can't find a way to delete it. The method used to add it was here.
Deleting the script didn't help, and neither did revoking access to my Google account.
What would I do to remove this menu from my menu bar so it no longer shows to the right of the "Help" menu?

The method you linked adds a menu when the Spreadsheet is opened. Have you closed the sheet and reopened it since deleting the onOpen() script? (and saving the script)
Without the onOpen() function in the bound script the menu will not be added the next time the Spreadsheet is opened.
https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#addMenu(String,Object)

Related

Can a spreadsheet (with format an everything) , be attached to a sidebar of another spreadsheet?

I'm creating a calendario asignacion Tools that works with sheets.
I have already make it work but I want to know if it is possible to attach a whole spreadsheets into a sidebar of the spreadsheets of the assignation tool.

SpreadSheet.removeMenu removes only items under the menu and not the menu itself

Tried the sample code under Spreadsheet.removeMenu() official documentation
And it removes the menu items("remove bad menu" and "foo") and not the menu(badMenu) itself.
Isn't it supposed to remove the menu?
If not, How to I delete it?
The menu will get removed once you refresh the Spreadsheet. But since you are using onOpen Trigger (Which run the function automatically every time the Spreadsheet is loaded) it will be added again.
Try renaming onOpen() function and run it manually to add the menu. Then click the sub menu removeBadMenu. At first it will remove the sub menu but when you refresh the Spreadsheet, the menu will get deleted.
Reference:
onOpen()

Google script embedded in google sheet adding a menu item

What I tried is adding some functionality to my google sheet (creating events and pushing them to the google calendar). Everything works, but when I close the script editor my menu disappears.
I created the menu items like so:
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Sync to Calendar')
.addItem('Create Events Now', 'CreateEvent')
.addItem('Delete All Events in Calendar', 'DeleteAllEvents')
.addToUi();
}
That works just fine, but I would like to close the script and also when I share the spreadsheet, the member shall be presented with the menu to click and execute the functions. Anyone has a solution how to make that permanent? (without publishing the script which would be an overkill in my opinion)
In some cases OnOpen doesn't run automatically unless the editor has authorized the script. In this case, you need to give editors a way to trigger the script, so they may authorize it, before onOpen will run automatically. You can either give them instructions to do this manually through the script editor, or you can insert a "button" into the sheet.
To do this "button" - insert an drawing into the sheet (the "button"), bind the drawing to your script, and have first time users click the drawing.
In your spreadsheet, click "Insert" -> "Drawing"
Draw a "button" image with useful text for end users ("Show custom menu" or "No menu? Click here!", etc.)
Place the drawing on your spreadsheet in a visible/convenient location.
Click the "three dots" on the drawing and select "Assign Script"
Enter the name of the function (eg OnOpen)
If a user opens the sheet and doesn't see your menu, they can click this "button" to activate the script. They'll be prompted to authorise the script as needed, then the menu will show from that point forward. They should only need to click the button the very first time they open the sheet, unless the scopes change or they manually remove authorization in account settings.
onOpen is a reserved word for a function to be called automatically when a Google Sheets spreadsheet is opened by the spreadsheet owner or editors, it will not run for viewers.
You should check that in the project there isn't any other function named onOpen otherwise another function declaration could be executed instead of the one that you expect.
Reference
https://developers.google.com/apps-scripts/guides/triggers
The suggested answer from Cameron Roberts works as a workaround.
Although in my case the problem was that the script trigger for onOpen was missing. I had to edit the script trigger within the script I wrote. In the script editor go to "Edit" -> "Current projects triggers" and add a trigger for the onOpen function with an event "on open". Apparently that was missing in my case, after that edit, it worked like a charm.

Displaying a Google form on sheets

I am creating a form for users to input information on a Google spreadsheet. They will access the spreadsheet and then click on an image that is linked to a script. When the image is clicked, I want a form to appear. Then I want the input from the form to be accessible in the script.
I am able to create a form but the form does not appear on the sheet. Here is the code thus far for the GS script
function startForm() {
var form = FormApp.create('myForm');
var item = form.addCheckboxItem();
item.setTitle('What would you like to do?');
item.setChoices([
item.createChoice('Budget Inquiry'),
item.createChoice('Add Purchase')
]);
var choices = item.getChoices();
// then I can respond to the user's choice
}
I would like this simple form to just appear on the google sheet. Any input would be appreciated.
Instead of creating you own form with script, just go to the insert menu of your spreadsheet and select form. Enter you question and your two choices. Close the form. You will see a form response sheet created in your spreadsheet. Also, a menu item Form will appear on your menu. Then go to the script editor and from the menu select Resources. Select Current Project Triggers and set a new trigger for onFormSubmit. You can then enter a function onFormSubmit to do whatever you want done when the form is submitted getting data from the form response sheet. There is plenty of documentation you can Google.
The way in Google Sheets to display external content other than images and Google Drawings is by creating a dialog or sidebar with the related content embeded.
There is a similar question that includes an answer that shows how to do this:
Single Google Form for multiple Sheets

Google Spreadsheet Script: Is a sheet hidden or visible?

In a custom Google Spreadsheet function, is there any way to determine if a sheet (tab) is hidden or visible?
Google has recently added the ability to hide and show sheets. To know whether the sheet is hidden, a new function isSheetHidden() has been added.
Unfortunatley Hide/Unhide classes for spreadsheets are unsupported. There is an open enhancement request. For hiding/showing sheets; you might like to star /comment it to be kept updated.