I have a script project in which some "padlocked" .gs files are shown. I can't edit or delete them.
I need to use those files, but the person who locked them is unavailable.
I was trying to unlock the files using methods from the class LockService but it doesn't seem to work that way.
How do I "unlock" these files so I can edit them?
I figuered it. The padlock doesn't point to actual files withing this script. There is a library in a standalone script containing these files. When I use debugger it reaches these files from a standalone library and they are shown within the script with a padlock. So padlock simply means that those modules are from a separate script file! So it's not a lock.
I handled it by creating same modules withing the script and simply renamed few functions. So I am able to use debug for all my route.
Unfortunately, only the owner of the file or an admin of your domain (if you're using G Suite) can do that.
I had the padlock appear on two projects I own, and am the only editor of, without understanding why they first appeared. They appeared on my work laptop but not my home laptop. At work I'd been signed into one browser window with both my work and personal accounts. When opening the google sheet that contains the script it opens signed in as my work account. However, when opening the script from the sheet, the script opened but signed in as my personal account (that also has access). I guess this shouldn't really happen but it did. The solution was simple though, I just had to use the drop down to select my work account, which opened a new window for the script without a padlock and I was able to edit as normal. Was quite confused for a while... phew!
I had the same problem. As it turned out none of the above fixed it although similar but different to the other person who fixed his. In my case i have multiple chrome users on a single machine. I log in at the browser level. I was in the browser for user A who also owned the file. When I opened up the bound google script project attached to the gooogle sheets file, it opened up as it should but locks were on each tab. I was confused for about 10 minutes.
In the upper right corner of the interface, there was a drop down that was showing User B email address even though above that, at the browser level I was clearly in the browser of user A. I clicked that drop down and changed to User A and the locks disappeared. It seems they have an odd way of managing users on these gsp's that subverts the browser level user login.
Related
We are a small company which just switched from paper to tablets (Surface GO Win10 Home) and we have one particular sheet which is used for every order (about 100 orders per month). This Google Sheet acts as a template for every single order and includes some easy code which is written in a bound Apps Script project, to handle things like switching the status from started to finished, copying some cells etc.
My problem is, when someone of the team wants to use the created "buttons" in the sheet to activate the script, it asks for authorization for the script the change the sheet. If you enable it, everything works fine but then for every new order you have to enable it again, and again, and it gets really annoying for every team member.
I tried somehow to
turn it off in the security options as administrator
tried it in the GOOGLE CLOUD PLATFORM under API's and services
tried to make the code somehow public in the script editor options
...but nothing seems not to work. I used VBA programs a lot in Excel VBA but it was more a hobby and I'm not a computer scientist, otherwise it would maybe be easier to solve this problem.
Is there an easy way so every one of my team can work with the sheets created out of a template without any request from Google for authorization every time.
Kind regards.
The reason for the popups is that Google Apps Script is not part of Google Sheets itself, it's a separate application that uses OAuth 2.0 to get the permissions to make the requests by calling the APIs. The popup shows the scopes you are authorizing for. This means that you can't disable that.
Note that apps script could do more things that just edit the spreadsheet itself; it could get other files, get your personal information, call external servers, etc. Also, the authentication process will only happen once per file.
This question already has answers here:
"Sign in with Google temporarily disabled for this app" error when trying to authorize a script
(5 answers)
Closed 2 years ago.
I'm on a windows 10 computer using a Chrome browser.
My problem is getting permission to run a Macro. For an individual user there are two pop ups that can appear when you record a macro and try to run it. One pop up has an 'Advance' link which warns you of the danger, but then lets you proceed with the 'unsafe' macro.
Sometimes, however, you get a pop up saying the approval process has been temporarily suspended and there is no 'Advanced' link to allow you to proceed. In essence, you cannot record and run a Macro.
I've been messing with this for days trying to figure out what causes one popup to appear as opposed to the other. I am completely mystified.
Last night someone shared a sheet with me. I made a copy, renamed it and moved the copy into my root drive which I share with no one. I recorded a simple macro, was told I needed permission, got the popup with the advanced link and was able to run the Macro.
This morning the person shared another sheet with me and I repeated the exact same steps of copying, renaming, moving the copy o my non-shared root folder and tried to record a Macro. No luck. I got the popup saying permissions were temporarily suspended with no advance link to let me move ahead and run the macro. How can this act so differently 12 hours later?
Can anyone offer me an explanation of what is happening? I'm now two days behind on delivering a promised project trying to figure this out. Thanks for any help anyone can provide.
Instead of using a Google Sheets Macro use a G Suite editor add-on.
The cause of the "Advanced link" is not being shown is because there are "too many" users running the unverified script
From https://developers.google.com/apps-script/guides/client-verification
User cap
The number of users who can authorize an app via the unverified app flow is capped to limit possible abuse. See OAuth application user limits for details.
NOTE: You might not have to publish an add-on as nowadays the verification process can be done without adding the G Suite Marketplace SDK, but if you will need to use the same code on multiple spreadsheets you will only need to do the verification once whil having multiple copies of a spreadsheet with bounded code will require to do the verification for each copy.
I am trying to create a custom function for a Google Sheet. to do this, I start from within the Sheet that I want to use the function, I then go to the menu Tools|<>Script Editor.
I then write a function. Name the file. And save it.
But, I can not use this function. Error #NAME?
Then if I close the Script Editor and open it again, it's like I have never been there. It presents the same form you see when you first start.
From an OP comment
I have discovered the issue, but not the solution. When the script editor is opened it switches me to another Google account I have. So I switch back. But then I am presented within a screen saying Acess Denied and making me ask permission. To whom and what for I am not sure.
The solution to the root cause of the problem depends on Google, fortunately there are several workarounds.
Use Chrome in incognito mode with all the extensions disabled, then sign in on only one account (the key part is bold)
Use another web browser or web browser profile. Sign in on only one account (the key part is bold)
Signout of all your Google accounts, then sign in first on the account that you will be using for developing your scripts, then sign in on the other accounts. This still migth be problematic under certain circunstances.
Also, as good habit, when you click Tools > Open script editor to create a new bounded project, the first thing that you should do is give a name to your project.
Another god habit, before testing a custom function, be sure that there isn't a project file with a red asterisk (unsaved file). Contrary to spreadsheets, the Apps Script files aren't automacatily saved when a edit is made.
I have a script which adds new rows and changes the sheet in some ways.
I'd like to lock this sheet so it cannot be edited manually, but allow the script to be run.
Is there a way to do this?
Yes, it's not the most easier thing to do, but it's possible.
But before we start it's important to understand how Google spreadsheet/sheet protection works.
There's no way to protect a sheet or range from the file owner. So, if you also want to protect a file from yourself (assuming you're the owner). Then the only solution available now (I do hope they change this in the future) is to change the ownership of the file to another account. What most people do is use another Google account that they don't use actively (you can create a bogus easily if you don't already have one).
Then, after you have transferred the file to another account, you can easily lock changes to ranges, sheets or the whole spreadsheet using the regular GUI.
Ok, now to the script. When a script runs, it's always using the authorization of a specific account, and it can do everything that this account can. For example, when someone runs a script directly from the script editor, or clicking on a custom menu or image: it runs under the account of who's clicking. But if you set a installable trigger, then the script always runs under the account of who setup the trigger in the first place (not who's performing the action that actually triggers it). Simple event triggers run as who's triggering the action (you can think anonymously), but they can't do much, it's a security feature (read the link for a better understanding).
Lastly, when one is publishing a script as a web-app, then there's a selection box to choose if the script runs as the developer or the user. Very simple.
Back to the problem. Since we have locked out everybody from the desired sheet/range. For a script to make changes to this locked area, it must run as the file owner!
If the changes you do are automatic, e.g. via a installable trigger, then you're good. Just setup the trigger using the file owner account and that's it. Also, if your users are accessing the script "externally", that is, via a web-app. Then that's easy to, just setup the web-app to run as the developer (the file owner).
The most complicated scenario is if you need to run the script from a custom menu, which will then run under the privileges of who's clicking on it, which themselves can not make changes to the protected area. The solution to this is to deploy the script as web-app running as the developer, and have the function running from the button click to call the deployed url using UrlFetch, possibly passing some parameters to designate what needs to be done. Then, since the webapp runs as the developer (which is the file owner), it can make any changes required, and return (if there's something to return) any value (usually a JSON) to the calling function (which is running as the user and is associated with his session), so you can show him a message on a popup or toaster, etc.
It's kind of tricky but works great, and you can do all that on the same script contained in the spreadsheet. But if you're concerned that your users may access the script editor and change the code (which is possible), than you should separate the web-app part on a different file, that you don't need to share with them.
Yes but only for others not for the script owner. Just use 2 accounts one as the owner and the other one as the reader.
I have added the DriveEye app to my Chrome, and enabled it to see my account. It is used for sending automated e-mail alerts on Google Drive shared folder activity.
It is not working. I receive only error messages ( I can not include it here as it is in Hungarian). It is about server error.
Then I removed the DriveEye from Chrome (drag and drop in the Chrome start screen). Nothing changed. I still receive errors.
How can I ged rid of it? How can I remove it completely or take the authorization back?
Thanks for helping
It seems I had the same symptoms.
There doesn't seem any way to remove DriveEye, but I found a way to delete its triggers, which stops the error emails.
Overview: The web-based authoring environment for Google Apps Script contains a menu item "Resources --> All Your Triggers". You can manage your Triggers here. (It appears to be the only place you can do this.)
Trick #1: Due to an apparent masking bug, you can't access this menu item unless you have at least one active script, and it is currently open. A completely empty dummy script will suffice.
Trick #2: Deleting the trigger(s) won't occur right away. You must preserve the script which you used to delete the triggers for an unknown amount of time. Might as well keep it indefinitely, I guess.
If you don't do any Google Apps Scripting, like me, you won't know how to get there. Go here:
https://developers.google.com/apps-script/
and click on the link "Start Scripting". Choose "Create script for ...Blank Project". You'll get an Untitled project window. Save the project with a descriptive name (e.g. "Dummy Scripting Project"). It will appear among your Google Drive (GD) files. (I used the GD web interface for this.) Reopen the script, access the menu item "Resources --> All Your Triggers" and delete DriveEye triggers. Save and close the project.
Now wait. In a few days, all the DriveEye error messages should cease.
HTH