Accessing scripts once the script has been written - google-apps-script

I followed the tutorial here:
https://developers.google.com/apps-script/articles/gmail_filter_sms#section3
I'd like to go back and edit the time-frame of the trigger but I can't find the script. It's been working for several days now and continues to work but I can't seem to find it anywhere.
Can someone lend a hand and tell me where I can go to edit the script I had originally saved?
Thanks!

According to the tutorial you were following, you created a container-bound script. You can read about scripts and containers here to get to know the differences.
The tutorial creates a script in the context of a spreadsheet (see steps 5-6 here), and you should be able to find the script pretty easily once you track down what spreadsheet you made it in. I'm fairly certain that it can still be executed if the spreadsheet is in your trash, but I don't have any documentation to back that up.

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.

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

Noob: Make my scripts available to me

Sorry for the dumb question, I have tried to search but did not find an answer. Please point if the answer is already been answered.
I am practicing writing my first google scripts (apps). If I create them from within a sheet they are only available to that sheet (bound). I can create them by creating a new script but I don't know how to make them available to all of my spreadsheets (not just one). THe scripts I downloaded from the store show up but how do I add my scripts.
I do not want to publish these to the world, I just want them available to me so I can access them from any sheet I am working with.
Basic question but I am having trouble understanding the process.
Thanks,
A script bound to a spreadsheet is only available from that sheet, you won't be able to access it from another sheet.
You can also create a script file (not related to any other document) but this will not be available from sheets.
This is how it is meant to be.
One thing you can do to use functions you eventually develop in a script is to make a Library of it, the functions in that library will be available to other scripts if you explicitly link the new script to the library (in the script editor > ressources>library) but this procedure is not as simple as the workflow you imagine in your question : each document will have to contain a minimal piece of code that will call the script library functions.
The last option to get create a "spreadsheet-with-script" and to simply make copies of this original spreadsheet (that has a script) and that copies will have the script copied as well.

How can I let others install my Google Apps Script?

I've made a simple script in Google Apps Script. The script builds forms based on a spreadsheet, the script itself is part of the spreadsheet. It adds a menu item. People would like to use it. They are non-technical people, so I would like to make the installation of my script as easy as possible. With 'installation' I mean a way to 'import' my script into their spreadsheet and automatically set up the needed triggers so the menu item becomes visible. It should be possible for anyone to install it.
I've been thinking of the following solutions:
Publishing as an add-on: my script wouldn't qualify, and even then I can't wait for Google's approval.
Copy-paste. I don't like this, it's way too complicated.
I've looked at this question: https://stackoverflow.com/questions/5334751/how-do-i-share-a-script-i-wrote-with-my-co-workers-on-the-same-google-apps-accou, but the people wanting to install it are not on the same domain in my case. The question is also 3 years old.
EDIT: As it turns out, there doesn't seem to be a solution. I've filed a feature request here: https://code.google.com/p/google-apps-script-issues/issues/detail?id=4122&thanks=4122&ts=1403949074
If your Google Account administrator allows you, you can share scripts/spreadsheets outside your organisation either by sharing directly with another person with a Google Account (Gmail or Google Apps) or by making it public (share with a link or published online).
https://support.google.com/drive/answer/2494822?hl=en
Keep in mind that if you use the Script Properties to store values, each time someone uses the shared script it will overwrite the values. In a shared context it is best to use User Properties instead. This way each user can store their own values.
https://developers.google.com/apps-script/guides/properties
There is no way to import a script in an existing spreadsheet , the "normal" workflow is , in a way, the reverse process, that's to say create a sheet from an existing template that already has the script in it and start to work with that copy.
From your description I'm not sure this method could be useable but I'm afraid there is no other way if you want people who will be using it should not go into the script editor at all.
There would be a couple of functions to write that should run at install time and would create the triggers (if needed) and trigger the authorization process.
I made such a SS some time ago that needed authorizations and I added an "install" menu that made its use quite simple (example here on a friendly hosting site).
I know this is probably not the answer you were expecting but it was definitely too long to fit in a comment anyway.

Google Apps Script Spreadsheets - Assign script to image from a script

I want to generate images with a script assigned to it using another script. I know you can insert images from a script link here, but I can't find a way to assign a script to that image from a script. I found someone requesting this feature here, but with no solution or workaround. If someone knows any way to insert a button that runs a script from another script into a spreadsheet, I would like to know it.
Edit: I have thought about using a trigger that would get the event source container and run a script on cell edit described here sort of, but I would love a gui.
This would be a cool feature, but here is a possible workaround, it might even offer more functionality.
You can build a UI using Google API.
More detailes here.
The UI allows you to create side bars/menus/etc. You could even create floating dialog windows. Using AbsolutePanel, you can even choose where the dialogue shows up.