Create auto-closing Sheets overlay to provide feedback without error - google-apps-script

Currently I'm using an alert window to give feedback to the user how many sheets have been exported and where. I noticed from Google Cloud Platform StackDriver logs that I got the error "Timed out waiting for user response" from that window, which means that some users just don't press the okay button. I can totally understand that, since this is information I want to show for a limited time.
So I'm wondering: Is there any best practise from Google how to show a simple popup that vanishes after a certain time? Maybe something similar looking to the Google working bubble at the bottom:

A simple popover can be found in the method toast(msg, title). Toast also supports a timed message toast(msg, title, timeoutSeconds)

Related

How to run a script in Google Sheets? [duplicate]

I am trying to run
this simple Google Script.
However, it does not allow me to authorise. How can I proceed?
Update 1:
As reported by
Rubén, Google says it won't fix this - #163
Some workarounds are provided in #76, #145 and #150 - showing solutions like changing GCP and providing a oauth consent screen.
Update:
Switching Google cloud project from default to a standard project have resolved the issue for some users. This is still a workaround and may not work for all. Therefore, star the issue below.
This seems to be a new issue affecting certain users. You can ★(on top left) star the issue here to let Google developers know that you're affected by this issue and to prioritize the issue.
It stopped complaining once I specified the script only needed access to the current sheet. Google explains how to do it here.
All you need to add to your code is this JsDoc annotation:
/**
* #OnlyCurrentDoc
*/
That's something that happens. To solve the issue just copy the contents of your Script, delete it, and create a brand new one with the same contents, or give it another name in case you are superstitious. If that doesn't work, create another Spreadsheet with the same contents and proceed. Sometimes it's just a temporary issue. Perhaps the problem persists due to the stored browsing data, so it would be convenient to clear it. (I challenge you to take this last move!)
After going through the process twice with a client, I can confirm that the most reliable way to fix the error currently is to go through the verification process. An important note is that after approving the scopes, some accounts need to approve every other sensitive scope that is added to the script and cloud project as well or the issue will resurface.
So the step-by-step guide is as follows:
Switch from default to standard Google Cloud Project
Fill in the OAuth Credentials screen and add all sensitive scopes
Click on "Submit for verification" and prepare a YouTube video showing both authorization process and usage of each of the sensitive
scope
Wait until the verification team sends you an email (usually 1-2 days, but no guarantee here) and reply with the link to the video, then wait for the verification process to complete
If you received a "Granted" response, continue to steps 6 & 7, if not - follow the instructions provided
Remove all previously granted permissions to the project
Reauthorize the script by running it again, everything should be working
Having the same issue no solution of listed in this thread were working for me. After faied authentification i always get the screen as the topic starter gets it, without the "advanced" option.
However i've managed to get at least a limited access and run my script on the following way:
I share the affected sheet to anybody with link, with editor access level.
Then, from incognito window (maybe it isn't necessary, but i did it so), I've logged in into my other Google account,
opened the link, which was shared,
was forced to authorize myself,
failed on authorization - but the screen with failed authorization contains the "advanced" option,
clicking on it i've got a limited access and was able to run the script.

"Sign in with Google temporarily disabled for this app" error when trying to authorize a script

I am trying to run
this simple Google Script.
However, it does not allow me to authorise. How can I proceed?
Update 1:
As reported by
Rubén, Google says it won't fix this - #163
Some workarounds are provided in #76, #145 and #150 - showing solutions like changing GCP and providing a oauth consent screen.
Update:
Switching Google cloud project from default to a standard project have resolved the issue for some users. This is still a workaround and may not work for all. Therefore, star the issue below.
This seems to be a new issue affecting certain users. You can ★(on top left) star the issue here to let Google developers know that you're affected by this issue and to prioritize the issue.
It stopped complaining once I specified the script only needed access to the current sheet. Google explains how to do it here.
All you need to add to your code is this JsDoc annotation:
/**
* #OnlyCurrentDoc
*/
That's something that happens. To solve the issue just copy the contents of your Script, delete it, and create a brand new one with the same contents, or give it another name in case you are superstitious. If that doesn't work, create another Spreadsheet with the same contents and proceed. Sometimes it's just a temporary issue. Perhaps the problem persists due to the stored browsing data, so it would be convenient to clear it. (I challenge you to take this last move!)
After going through the process twice with a client, I can confirm that the most reliable way to fix the error currently is to go through the verification process. An important note is that after approving the scopes, some accounts need to approve every other sensitive scope that is added to the script and cloud project as well or the issue will resurface.
So the step-by-step guide is as follows:
Switch from default to standard Google Cloud Project
Fill in the OAuth Credentials screen and add all sensitive scopes
Click on "Submit for verification" and prepare a YouTube video showing both authorization process and usage of each of the sensitive
scope
Wait until the verification team sends you an email (usually 1-2 days, but no guarantee here) and reply with the link to the video, then wait for the verification process to complete
If you received a "Granted" response, continue to steps 6 & 7, if not - follow the instructions provided
Remove all previously granted permissions to the project
Reauthorize the script by running it again, everything should be working
Having the same issue no solution of listed in this thread were working for me. After faied authentification i always get the screen as the topic starter gets it, without the "advanced" option.
However i've managed to get at least a limited access and run my script on the following way:
I share the affected sheet to anybody with link, with editor access level.
Then, from incognito window (maybe it isn't necessary, but i did it so), I've logged in into my other Google account,
opened the link, which was shared,
was forced to authorize myself,
failed on authorization - but the screen with failed authorization contains the "advanced" option,
clicking on it i've got a limited access and was able to run the script.

Unable to add new script in Adwords since new update

I've been a passive StackOverflow user for more than a decade now. I don't really think this is the place to ask this but Google Developers Help page referred me here.
Adwords has been updating to a beta version and I'm a heavy user of its Scripts console, but recently, when I want to ad a new script with the big red button, it starts loading and then this message displays: "There was a problem loading the script. Please try again later"
I've already tried with Chrome and Safari, a cookieless browser and with a different account and nothings seems to work. I also Google the error and there is nothing. I don't think I'm the only person experiencing this, do you have any solution?
I couldn't reproduce your problem and was able to create scripts—however, I've noticed quite a lot of bugs in the new web interface (to be fair, they say it's still in beta).
But as a workaround, just use the Return to previous AdWords link in the three dot option menu, which will take you back to the old interface. I could well imagine that you'll be able to add a new script there.

gapi.drive.share.ShareClient false when multiple users are logged in

I'm following https://developers.google.com/drive/web/manage-sharing#launching_the_google_drive_sharing_dialog_in_your_app to add a "Sharing" dialog to my Drive app.
It works perfectly when the user is logged into gmail with a single Google account. If they log in to gmail with a second account, the ShareClient in my app no longer works. Instead, it says "Sharing is unavailable at this time."
To be clear, the change happens after interacting only with gmail, NOT with my app. I guess the problem happens because the share dialog doesn't know which user to default to.
Does anyone have a way to make this work? I would be happy to specify a google id, but ShareClient doesn't seem to have any settings exposed besides appId.
This is an issue we are currently aware of and will fix.
There isn't really a good way for you to work around it at the moment, so hang tight until we address it.

Google Picker shows just a blank page

I'm trying to develop javascript application which would allow user to select files from their Google drive,and then pass IDs of selected files to PHP backend and download them to my server.
For selecting files I'm using Google Picker, and I could use it normaly for a few days but suddenly It stopped to work. When i click and try to open Picker dialog, loadPicker() function pass without any error reported by firebug but i get only blank iframe. I have tested it on several computers with several various browsers, all with the same result
First I was thinking that I've put wrong API key, but every time I try to load picker that attempt is properly loged inGoogle API Console statistic pages, altrought every time i get just a blank screen. I have also tryed to make a new application an just copy/paste Google Picker hello world app source code from Google documentation, but I'm still getting just a blank page.
Any suggestions why this is happening? Is it possible that Google blocked Picker service for my account?
So as disscussed at google groups thread it was a bug on Google side, it should'nt happen anymore.
I've had that problem too, while the picker was working correctly few days ago. I found the reason : in the meantime i had to create a Service Account key for other purposes (access to Google Apps Script apis). Using the clientId of the Web Application Key was causing a picker window with title and buttons but "No files found" inside, while my folder parent Id didn't changed.... I replaced the clientId by the one of the Service Account key, and it solved the issue. Good intuition.
I recently had the same problem. I can't beleive I spent almost two hours trying to figure the issue. In case you've tried everything expect closing the developer tools, please do that.
The file picker won't show unless the developer tools is closed.