How can I remove a bound script from a Google Sheets Spreadsheet? - google-apps-script

I have a spreadsheet where I first created a bound script file (via Tools->Script Editor). I then (at a later time) was exploring the File menu and hit Make A Copy. I now get a "Select a project to open" with the original "myAddOns" and "Copy of myAddOns" as the choices. I would like to remove the copy. I found it in the scripts My Projects page, but when I try to remove it the original spreadsheet also gets removed. (Pulled it back out of Google Drive Trash folder)
Am I stuck with this?
Thanks!

It turns out that (as the project owner) using the File->Delete Project once I open the Script Editor works. Not sure how I got messed up before.

Turns out that all of us can forget how to do this. Thanks for asking the question. In the new editor, this feature is found in Project Details, then to the far right. Click the Trash Can that warns "Delete Project Forever". Yes, please. Hope this helps someone in the future.

Related

Is it possible to add the same custom menu to every new google document? The goal is to make a local script function like an installed app

Is it possible to add the same custom menu to every new google document? The goal is to make a local script function like an installed app.
This seems like it should be easy but I can't seem to find a way to do it. I'm using a standard account for personal use. I've created a script attached to the original document and also made copy as a stand alone script. (I'm not sure that makes a difference.) I've searched and read about deployment and it seems to be only useful for a domain account or publicly as an app. I've played a little with scripting but this is the first attempt to get a script working "globally".
Any help will be most appreciated.
I found a way to do this in an old example at: https://sites.google.com/site/scriptsexamples/custom-methods/2d-arrays-library.
The script is in a project and that needs to be connected to the current doc. The onOpen() script is a UI that contains the line:
.addItem('Select Phrase', 'PS.showPrompt')
where PS is the name of the attached library. Once this is done, as you said, you can make a copy and use it with the script active.
It is a little slow as they describe about using a library, but is make the code easier to maintain. Thanks to all for the direction to look.
What we do is create a copy of the original document (the document with the attached google apps script). The script is copied along with it and the copied document has the exact same functionality (menus, custom functions, etc).
You could create a Google Docs Add-On using an independent Apps Script script and then install your Add-On globally. For more information regarding its installation check this documentation. However you would need to run this Add-On on the new documents to get your desired menu.

How can I remove a project from a Google Spreadsheet?

I made a copy of a Google Apps Script project by mistake by choosing File > Make a copy... on Script Editor and since then every time I click Tools > Script Editor... on the Spreadsheet screen the project belongs to, I see a screen showing the two projects (original one and copied one) and I need to choose one to open the script editor. To be worse, the original script became unexecutable since I made the copy, I don't know if this is the cause of that though.
So, I'd like to remove the copy project from the Spreadsheet. How can I do that? I can't find any menu to remove project.
Thanks,
Open the "copy of" version of the script, click File -> Delete Project... This will generate a confirmation box. Click the Delete button to confirm that you would like to delete the project. This should leave your original as the only associated script.

Sharing a document doesn't share the script?

I have a Google Sheets document with a bunch of script attached. I view and edit that script using Tools > Script Editor. This script also adds a new menu to the toolbar using the onOpen function.
If I share the document with a colleague, she sees the new menu and can run scripts in that menu, but Tools > Script Editor is disabled for her.
I'd like anyone with access to the document to also see the script. Do I need to create an add-on or something instead?
As documented in Google reference documentation, document bounded scripts inherit the sharing properties from their container.
(A few years ago it was not the case but even very old documents have all been updated).
If the behavior you describe can be repeatedly reproduced then you are most probably facing a bug and should report it to the issue tracker.
In the mean time try to make a copy of it and share it with the same user to see what happens.
A similar issue occured to me a while ago and unsharing/resharing the doc solved the issue. Worth trying...

How to share one Google Apps script between few documents?

I wrote short script for numbering of document sections. But every time when I want to use it in new document I must create new copy of that. I tryed to publish the script by option "Deploy as web app..." but it is not clear how to connect it in new document. Is it possible? I have few documents in Google Drive and few copies of same script for each of document. Can I connect every document to one script? Thanks a lot!
This is not possible for now, there is an open enhancement request that you could star to mark your interest and be informed if something new comes up...
I had a similar problem.
The leaner solution that I was able to imagine is to keep the function in a saparate, shared script file. In the spreadsheet script, you will use the shared script file as a library.
In this way, your logic remains in a single copy, the actual part of the logic that is copied several time is only a call to a shared function.

Locating a google apps script months after you've saved it

A while back I created a "Gmail Snooze" script from this Lifehacker article http://lifehacker.com/5825634/how-to-add-a-snooze-button-to-gmail-no-extensions-required
I'd like to make some edits to it now but I can't find it! When I go into the script editor I have no saved projects to open. Can anyone point me towards a method of finding this script that is running every night so I can edit it?
The File > Open dialog usually only shows you the script projects that are attached to the spreadsheet you have open. If you open the editor directly that menu should show you all the projects you own.