I've create a spreadsheet with a script for copy some other spreadsheet with a script inside, this worked fine for a moment.
But for several days all my scripts, on all news spreadsheets copied, they doesn't worked and they blocked when a complex line come (For example : DriveApp.getFileById(id))
(I say complex for script when onEdit, onOpen or other function can't run the line)
After somes researchs and reflexions, I think the problem come from the settings of my domain (G Suit), because when I use a new spreadsheet's script on an other account, they doesn't work, but if I use my old spreadsheet's scripts, they does work fine. I'm not sure.
The error messages I receive (it's when the script is out of time) are :
- An error has occurred on the server. We apologize and invite you to try
again later.
- Exceeded authorized execution time
I've tried to create a new spreadsheet and rewrite the script manually but I got the same error.
I'm not sure if it's only my domain, probably Google got some error too (But after 5 days it's strange).
Please, someone can help me, for say me if it's a problem with google, my domain or any other way.
(Sorry for my bad english)
Thanks in advance
Check the answer I've provided here.
You'll just have to enable Drive API for the project and from the Google Dev console.
Related
I'm using Apps Script and the OAuth2 for Apps Script Library to connect to a couple Google advertising platforms. Basically, each account team has a Google sheet that automatically gets their campaign data every morning. I've got a couple of these sheets up and running already, but when I try to set up this most recent sheet I'm getting the "Authorization is required to perform that Action" at the very end of the OAuth process. I'm able to start the OAuth dialogue, select an account to authorize, but then I run into the error.
I authorized the script in the script editor before I ran it, and all of my OAuth credentials are correct. I've even deleted and re-created the scripts. The other sheets running the same scripts are still working fine.
What's going on here? I'd appreciate any ideas, I've set up a couple test sheets to see if I can puzzle it out, and now they're all returning the same error.
Update: Everything works properly when run from a different account, so it's looking like it's a problem with my account, specifically. Is there any way to manually check that an Apps Script project has been authorized correctly on a given account, aside from the prompt when the script is first created?
I ended up fixing it by explicitly setting the Authorization Scopes in the manifest. In case anyone finds this question later, here's the links to the relevant Apps Script guides:
Authorization Scopes:
https://developers.google.com/apps-script/concepts/scopes
List of OAuth 2.0 Scopes:
https://developers.google.com/identity/protocols/googlescopes
I have a spreadsheet with a script that includes onOpen() which successfully creates some custom menus. When I copied the spreadsheet (and the bound script of course), the onOpen() no longer runs. I tried a few things I found from other postings of the same problem:
Revoke the new spreadsheet's authorization - can't because it does not show up in my account as an authorized app.
Manually create a trigger for when the doc opens - I get an error "We're sorry, a server error occurred. Please wait a bit and try again."
Copied the script file itself and renamed it.
Renamed the enclosing script project.
Renamed the enclosing spreadsheet.
So, none of these has worked. Anything else I can try, or is there a known problem on Google's side?
Thanks!
I looked at the said issue tracker and found that the problem stemmed from this line of code:
DriveApp.getFileById(SpreadsheetApp.getActiveSpreadsheet().getId());
To make this work, I would suggest to enable the Drive API in Resources -> Advanced Google Services. It will also ask you to enable Drive API in your Google Dev console. Do this and let me know if it worked for you.
I have several scripts bound to a spreadsheet that create 14 folders containing a total of about 240 google sheets. The original sheet that the scripts are bound to contains about 34000 rows of data that are divided among the newly created sheets. While I was working on it I frequently deleted and recreated all the folders and sheets and it worked fine. Yesterday, as I'm ready to do my final run and create the spreadsheets that will be shared and used I started getting "We're sorry, a server error occurred. Please wait a bit and try again". I tried again this morning and got the same thing.
I have tried a different browser. I created a new sheet and copied the scripts over. Then I deleted all but a single script that creates the folders and commented out all of the code in that except 3 lines that get the current spreadsheet and write out a message but I'm still getting the error.
The link to my stripped down, barely there but still not working spreadsheet is https://docs.google.com/spreadsheets/d/18_FjSpuGONEVzNZu5Ta8hm0YopsdlZlPRRAV7cx5VTE/edit#gid=1999362590
I'm thinking it may have something to do with my user account, or having reached some quotas. Is there any way to check that?
If you reach a quota when using a Google App Script, it should notify you with a specific exception. The quotas themselves can be seen here.
Have you tried removing the permissions for the script and authorising it again? I have had this issue previously and this resolved my problem (although, I accept it will not always resolve this problem...).
I would post the link, but I don't have enough reputation to post more than 2 links... Google "See apps connected to my Google account".
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.
I have some exisiting google app scripts in a spreadsheet of my google drive.
Tried to create a time driven trigger under Script Editor -> Resources to automate the execution of a script. Encountered error: 414. That’s an error.
The requested URL /... is too large to process. That’s all we know.
Read through some of the existing similar issues/solution. Nothing specific to time driven triggers found.
Anyone has a workaround ?
Have you tried running the script without the trigger? I find most times I get that error it's because I'm trying to add a trigger to a script that I haven't yet run and authorised first. Good luck!