Google sheet Script Permission to anyone - google-apps-script

i have a google sheet , i wrote two scripts under it. one is "Dependent Dropdown" and another is for "Reset Data" to clear entries. Everything is working fine in my machine. script working ,dropdown also working with no issue.
but i have to share sheet with my colleague to edit this. i shared sheet with permission "Anyone with the link can edit".
now my colleagues can edit perfectly BUT those two scripts are not working.
do i have to set script permission ? or what? help please.
thanks in advance

unfortunately, that's the bottleneck of scripts - each colleague of yours needs to authorize the scripts otherwise they won't work for them.
there are installable triggers - https://developers.google.com/apps-script/guides/triggers/installable but user interference is still needed.
one way would be to create a shared account where scripts are authorized and then every user would use that account to access the spreadsheet

Related

onEdit script does not start for users under anonymous access

it's my 1st public question, hope I'm clear enough.
Here is the context:
I have created a spreadsheet as a template, including an "onEdit script"
I have made a copy of the spreadsheet created above, editable by everyone who has the link
when I open this copy and :
edit it, under my account (as owner), script works :)
edit it, under another google account script works :)
edit it, from an anonymous access, I can edit the sheet, but the script does not work :(
I have already read many posts like https://support.google.com/docs/thread/10422866?hl=en&msgid=10677830,
also tried this : https://support.google.com/docs/thread/41307278?hl=en&msgid=41569467. Got the same difference related to user access. :(
In fact, I need to share sheets with publics (without expecting Google account) and, because they are invited to, I need to determine which cells they may have edited.
Any idea will be greatly appreciated ! :)

Script always active

Sorry if this was asked before but I could not find then answer.
I created a spreadsheet that is used by many users. It has an onEdit script. However it only works for me. Does every single user has to accept access for the script to change the spreadsheet?
The script will be run by and have the permissions of the owner that created the trigger to the script.
Ie if your account created the simple or installable trigger and steve opens the sheet, his actions will trigger the script to be run by your account.
None clear behavior that I have noticed that might explain what you are seeing:
- if lets say bob only has read only access or comment only access to the spread sheet no triggers will fire for his instance ( ie onopen() ).
Feel free to attach your full or a snippet of your code and trigger settings and someone should be able to assist in debugging.

How do I restore revoked permissions on a google-apps-script?

I mistakenly revoked permissions on a google-apps-script that ran on a time trigger on a google spreadsheet from here: https://myaccount.google.com/permissions . I now receive an email that the script fails to run. Going to the spreadsheet and editing the script fails to bring up the script, presumably because of the lack of permissions, but no error is shown, just a blank script editor. I am able to see the trigger to the script (here: https://script.google.com/macros/triggers?id=some_id ), but I am not able to get to the script.
How can I restore or reinstate the permissions to this script?
Or how can I get the code to this script? Where is it stored?
If you simply revoked permissions it will not remove the actual script/coding. So it may not be attached to the spreadsheet you are opening. Perhaps you are opening the wrong spreadsheet, or it is a standalone- If you type type:script into your google drive search it will show all scripts that are not bound to a spreadsheet.
As far as restoring you will just want to run it, once you find it.
I was successful. I'm not sure what did it but: previously I was not able to view the script, looking at the revision history doesn't allow me to get access to the menu and thus I was not able to get at older versions of the script. But making a copy of the spreadsheet then allowed me to view the script again, both in the original and copy of the spreadsheet. Running the script then requests for permission, restoring the permissions!
I really don't know if the lack of access to the script was a temporary condition or required that I make a copy of the spreadsheet, but this was the sequence of events that worked for me.
Thank you #OblongMedulla for making the suggestions.
You can simply go to your Google Profile - Manage Your Google Account - Security - Third Party Apps and revoke the permissions. If you want to use the app again, you'll have to run the script again from appscript and grant the permissions.

I can't find a Google Script I created (that is not attached to a spreadsheet)

I am having trouble finding a saved script. I followed this post to create a script that schedules email deletion, and I believe I saved it, but searched for it in Drive to no avail. The script is still running because emails are being deleted.
Things I've tried
I've read other posts that mention tracking down the spreadsheet that a script is attached to, but I didn't create a spreadsheet (unless scripts are all mysteriously attached to a spreadsheet).
I searched Drive.
I attempted to visit script.google.com while signed into my account. It said that I need permission and that I need to ask the owner for access. This is a work account managed by Google Apps. I asked my admin and he can't access script.google.com either. The only thing I can think of that's worth mentioning is that we changed domains at one point, but I can't see how that would affect ownership or permission.
So, two questions really:
Where is the script?
Who is the owner of the account?
Any help would be appreciated.
Don't know if it helps but you can try by accessing this link:
https://drive.google.com/drive/u/0/search?q=type:script
Also if you have a google apps account recheck with the admin if he has given you access.
Recheck your permissions at:
https://security.google.com/settings/security/permissions?pli=1
In there you can try to find the script if you ever ran it using your account.
Also might worth to take a look into this dev article:
https://developers.google.com/apps-script/guides/services/authorization#authorization_lifecycle_for_add-ons
Hope it helps!
You can also try visiting the Google Dashbboard at:
https://script.google.com/home/
This is another link to try in Google Drive, which will find all files in your Drive of type script, and restrict to those owned by you.
https://drive.google.com/drive/u/0/search?q=type:script%20owner:me

Using Google Script in shared, restricted spreadsheets

I wrote a script for a google spreadheet which is run by clicking on an image embedded in the spreadsheet.
Everybody with the link to the spreadsheet can edit it (except some areas with formulas etc. which are protected).
When I'm logged in with my google account, everything works fine, but when I log out and try using the spreadsheet like a "normal" user, nothing happens when I hit the image.
I didn't find anything in the options regarding "script sharing" etc.
Would be awesome if someone could give me a hint (I'm quite new to google script...).
Thanks for your answers!
Vincent
Anonymous users can't run scripts. By design. Protected ranges, sharing and all the rest of it have nothing to do with your problem.
The user - whoever they happen to be - must be logged in to run any script. Scripts will simply be ignored for anonymous users.
So the solution in your case is to tell all your users that they must log in before being able to run a script.