Delete a google-apps script - google-apps-script

I've created a spreadsheet, and over the years I've been editing/adding scripts to this spreadsheet to extend functionality. While doing this, I inadvertently created some extra projects. Now when I click Tools -> Script Editor, it comes up with the following:
How do I delete "Copy of Character Data", and "Untitled project"? I'd like to keep the google spreadsheet around (As I'd like to keep its revision history).
I've tried following this post, but to no avail. Going to "script.google.com" simply loaded my last script, and didn't give me some type of dashboard where I could remove individual scripts. I see no delete option anywhere, and there is no scripts that I could find in "drive.google.com".

Choose the project you want to delete and when you are in you have the option to delete it (as long as you are the owner of the project).

If you don't see the option Delete project, that means those projects weren't created with the account you're logged in. Log in with that account or ask the person who created them to delete those projects.

Related

Google script trigger 'from Spreadsheet' not available

I've successfully created picklists from a Google sheet into a Google form following a tutorial (http://wafflebytes.blogspot.com/2016/10/google-script-create-drop-down-list.html) and Google's documentation, however I do not have the option to set a trigger on the Event 'From spreadsheet', as laid out in the the tutorials/documentation, so I must be missing a step and haven't been able to figure out what it is.
The result is that the options are not automatically updating and must be manually pushed. I would like to enable the options to be refreshed on open.
I do not have the option to updateForm + from spreadsheet, as pictured in those resources.
From tutorial
My options
What step am I missing? Or is this possibly a permissions issue (I am not owner of the documents, but I tried to reproduce this in docs I own and ran into the same issue)?
NOTE: I have not posted my script here because it's nearly identical to the one linked to in the tutorial.
Update:
I'm beginning more and more to think it has to do with our OAuth configurations or permissions. I even updated the manifest to explicitly authorize forms and sheets, but I'm still not offered sharing permissions. I will have our admin check in on this but if anybody has had experience in these matters, I'm all ears.
Since your options shows "From form", you are working on a project bounded to a form instead of the one that you created from your spreadsheet which is the one bounded to spreadsheet.
Rather than missing a tutorial step it could be that you had several script projects open at the same time and you are looking at the wrong one.
Reference
Event Objects

google spreadsheet script editor: delete a project

I have two script projects for a spreadsheet. One was a temp one for development testing. I want to delete the temp one. When I click on script editor it shows both projects, and I can select one, but there is no option for deleting.
Also when I open the project itself there is no delete option.
I have seen other SO threads (such as this), but it seems the interface is changed since then.
Attached the screenshots.
Script Editor File menu:
Make sure that you are the owner of the script.
I've tried to replicate your issue in other scripts which I don't own and it seems that I cannot see a Delete Project... option under File menu.
But with my owned script, there is a Delete Project... option. See screenshot.
Here's a reference post: How can I remove a project from a Google Spreadsheet?
UPDATE (based from OP's comment):
You must be the owner of the spreadsheet to show the Delete Project... option.

Allow other users within domain to use google apps scripts

I have written some code within my Master spreadsheet, and then added the script ID to the library on other spreadsheets owned by me. I am able to run the scripts on those other spreadsheets. However, when I share Edit level access to other users and the scripts don't run when they log in. I have to share each spreadsheet on an individual basis, as they contain confidential information (e.g., payroll info).
Here is the process I used.
Get the script ID from the Master spreadsheet.
On each individual's payroll spreadsheet I added the script ID as an included Library. There is a toggle for Development Mode, set to ON (although, I'm not clear on what that is).
Add references to call code from Master.
Again, everything works as expected when I'm logged in, but not when the users are. First of all, the onOpen trigger doesn't work (it should make a menu and then jump to the current month's sheet.) If that user opens Script Editor and attempts to run the script, it says something like, "User doesn't have access to library Master or it has been deleted."
Hopefully I'm just such a noob that there is an obvious oversight. If you notice it, please let me know how to correct this!
Thank you in advance,
Neill

How to prevent Apps Script from opening multiple projects?

I have an html dialog for Sheets (container bound dialog) that is used for input and saving of customer data. I made a copy of it for use in a different office, so now I have Worksheet#1 with Script project "Scripts" and Copy of Worksheet#1 with Script project "Copy of Scripts". We've made changes to Scripts so it is no longer the same as Copy of Scripts.
Sometimes Worksheet#1 triggers scripts that are in Copy of Scripts. Not sure why. On these occasions I can open up script editor and it asks which project to open (Scripts or Copy or Scripts) and once I select the right one it behaves properly until the next time this happens.
How can I insure that it always opens the correct project?
You will see this behavior sometimes if you have multiple projects within a script.
Check whether you have multiple projects in one of those sheets.
File > Open...
Here's a spreadsheet-contained script with two projects in it:
Open the project you want to delete.
Delete it.
File > Delete Project...

Sharing a Google Spreadsheet containing a script with a workgroup so they can use it, but not modify it

I have written a Google Spreadsheet script which reads data from a user provided CSV file, populates a sheet with the data, makes a copy of the spreadsheet with a different name, and provides a link for the user to click to see the new spreadsheet. After making the new copy, the original spreadsheet is then cleared of user data and restored to its original state so other users can use it.
I want to share this spreadsheet with the workgroup (several hundred users), but I don't want them to be able to modify either the sheet or the script. If I share it read-only the script won't run, but to get the script to run I have to allow users edit capability and that is a bad thing.
I have googled myself silly trying to find a direction in which to go, but I am still wandering in the wilderness.
Can any of you point me in the right direction? If I need to be more specific or provide more information I will be glad to do so.
Thanks,
Larry
P.S. Other questions of note:
o Is it possible for a app-script in a spreadsheet to make the new copy active and 'close' the original shared spreadsheet?
o Can the user be made the owner of the new copy?
There is the option to put the code that you don't want modified, into a Stand Alone Apps Script file, then use that code as a "Library" in your script bound to the sheet. You can set the permissions on the Stand Alone Apps Script to VIEW only. That will keep people from changing it. When you share the Apps Script file with the users, they will get an email notification. So, they'll have the URL to the file, and can view it, but they can't edit it. (If you set it to VIEW only)
So, you'll be using both your spreadsheet file, and a Apps Script file. Two files, and setting the sharing to VIEW only on the Apps Script file. You can still give people EDIT access to the spreadsheet.
You'll need to go through a process of making the function available to your spreadsheet. This is called a "Library", but don't pay much attention to that name when creating the file.
Create a Stand Alone Apps Script
Create the function you want to share.
Get the Project Key --> FILE, PROJECT PROPERTIES
Share the Apps Script file with users you want to give access to, but only give them VIEW access to the file. NOT Edit.
Give the Project Key to the user, (In this case that's just you.) and have them add the library, or if you have access to the spreadsheet, you can probably add the key yourself. So, in your case, you will not be sharing the Project Key with anyone. You don't need to.
In the script file that is bound to the spreadsheet, click the RESOURCES menu, and the LIBRARIES menu item.
Enter the Project Key
Click SELECT button, and turn the library ON.
Make sure to set the library Identifier to a key word you'd like to use.
Go to the code editor, create a function, and type the Library Identifier.
All the functions that are available from the Library will show up
Google Documentation - Gaining Access to a Library
Keep in mind, that creating a library is nothing more than writing code in an Apps Script in a stand alone Apps Script file. If you've done that, then all you need to share is the Project Key. The user of the Library won't see a list of all the available Libraries when Resources, Libraries is opened. You need the Key.