Google App Script web app cannot be opened by others - google-apps-script

I have deployed a web app using google app script. In my computer everything works fine, the app loads data from a google sheets file and presents in a table. The issue comes when I try to share the deployed link with others. I already changed permissions of the app to "Anyone", "Anyone including anonymous", execute the app always as myself and execute the app as the user and nothing seems to work. When users clic the link they only see a Google sign saying the file can't be reached. Do youy have any suggestions?
The link of my latest implementation is here:https://script.google.com/macros/s/AKfycbwhBuYsrRVabtSm983UWYCtRQ3KRn9ATmp0r7wGFVasMWQUjpf7L6h2qUIDRA5SFEg/exec
Thanks.

It's very likely that you set the web app deployment to be run as the user accessing the web app but the spreadsheet is not shared with anyone on the web / anyone with the link.
To fix this change the spreadsheet sharing settings accordingly.
Please be aware that once the users access the spreadsheet through your web app they will be able to find the spreadsheet in Google Drive and in Google Sheets > Shared with me.

I have a same issue with you Rivaa.
What I did is:
https://script.google.com/home > let the others check on 'Shared With Me'
give ur email via Lastpass in order to avoid show your password
I hope these will help you more or less.

Related

Prevent Users from Manually Editing the Spreadsheet

I created a web app using Google Apps Script and sharing the link with editor access to other users is needed, otherwise, their input in the web app will not be recorded in the the spreadsheet connected to it.
My worry is if they manually edit the spreadsheet since they have editor access to it.
Is there a way to prevent them from editing the sheet manually?
Deploy the web app with the Execute the app as me option to run it under your account. You do not need to share the spreadsheet or the script with anyone.
See the Web App Demo answer for more information.

How to solve the error: Sorry, unable to open the file at this time. Please check the address and try again. (Gmail Add-on)

I have a Gmail Add-on deployed on marketplace, it was working fine but now when a user have multiple accounts logged into gmail and tries to install my add-on. It shows the error
Sorry, unable to open the file at this time.
Please check the address and try again.
The URL of opened popup is (script_id is my project's script id ): https://script.google.com/macros/u/1/s/<script_id>/authorize?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.addons.current.action.compose%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.addons.current.message.metadata%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.addons.execute%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fscript.external_request%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%2Chttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile
When only one account is logged into Gmail, then it works as expected and add-on is installed normally.
I checked other solutions to the same problem, then say we need to remove /u/1/ from the URL. I copy pasted the URL into another tab and removed /u/1/ from the URL. I still got the same error. Also, this URL is generated by Google and not by us, so we cannot edit it.
Any help for the problem mentioned above will be appreciated.
Thanks in advance.
This is a well known issue regarding Apps Script and the way Google handles multiple accounts being logged in.
The documentation states the following regarding this matter:
If you're logged into multiple Google Accounts at the same time, you might have trouble accessing your Apps Script projects, add-ons, and web apps. Multi-login, or being logged into multiple Google Accounts at once, isn't supported for Apps Script, add-ons, or web apps.
Possible workarounds for this include:
Logging out of all your Google Accounts and only log in to the one that has the Apps Script project, add-on, or web app you need to access.
Opening an incognito window in Google Chrome, or an equivalent private browsing window, and log in to the Google Account that has the Apps Script project, add-on, or web app you need to access.
This is currently being tracked on this report here; I suggest you star it as any updates regarding this will be posted there.
Reference
Apps Script Script Projects.

Unable to access spreadsheet which is published to the web from appscript

I've written a app script(web app) to access spreadsheet and display it's content based on search criteria.
Web app should display content based on given name
It is working fine with my own gmail account. But when other users(given access for app script web app) tried this app they're seeing error as
"Exception: You do not have permission to access the requested document." It is throwing an error when SpreadsheetApp.openById(spreadsheetId) is executed.
By giving an explicit access(sharing with user) to the spreadsheet, he is able to access the data without any issue.
But as spreadsheet is already published to the web to access by anyone, why should it required again an explicit access to execute spreadsheet.
Is there way to access spreadsheet data without sharing it with the end user? Thank you in advance for the help.
I understand that you published a web app that opens a certain Sheet. In the "Deploy as web app" menu (opened from the Apps Script editor and selecting Publish ⮞ Deploy as web app) you would have been asked to determine how to "Execute the app as". You can choose between these values:
Me: every web app user will open the Sheet as yourself.
User accessing the web app: every web app user will open the Sheet as themselves.
As a consequence of the second case, the users would need previous access to be able to open the Sheet. Since you want to give them access no matter what, I recommend to use the first option. Please, ask me any additional doubt.

No Such User when trying to access google apps script editor

In my Google spreadsheet, when I go to "Tools->Script Editor..", I get a page saying "No Such User" Error. Any idea how to fix this?
I figure this could be a permissions issue, but not sure how to change permissions if required.
Finally i found the solution accidentally.
The issue is resolved by enabling GoogleAppsScript as part of your drive.
Open Google Drive in your web browser.
Click New > More > + Connect more Apps
and then select GoogleAppsScript.
Once i did this going back to script editor of my spreadsheet, no more gives any error.
Here is the link which contained this step:-
https://developers.google.com/drive/v2/web/quickstart/apps-script
Also there is additional problem about Invalid OAuth Client when trying to run the script. which i faced since each apps script has to be attached to a Google Cloud Project. This is accessible only to the person who originally created the file even after its in the team drive. In which case, you need to make a copy of the apps script available by going into File->Make a copy. And then in the Resources drop down , you will see Cloud Platform Project, upon clicking it you can now give the project number of the Google Cloud Platform project you created on console.cloud.google.com.

Google App Script no longer have "Allow anyone to access" option when deploy to web app

i have a couple of google app script that reads and writes to a google spreadsheet
I used to deploy the script as a service to allow anyone to access, I allow "invoke as me"
Recently, I notice that the interface has changed to "deploy as web app"
However, now there is no option to "allow anyone to access". There is only 2 options to run the script either "only me" or "only anyone in domain"
Has Google changed the policy to not allow anyone to access scripts?
Or have I done anything wrong? Please advise
I really need the scripts to run publicly
urgent. thanks
It is possible. Here's what I did:
Go to the control panel of your Google Apps Account (instructions here)
Select the Settings tab
On the left, under Services, select Drive & Docs
In Sharing Options, select "Users can share documents outside this organization" (I've left the "Warn users..." check box blank)
Also in Sharing Options, I've selected "Private" under Document Visibility but I'm not certain that's necessary. You could try with/without.
Go back to Deploy as webapp in your script project and you should now see "allow anyone to access" - at least I do in mine!
The documentation seems to be quite clear on this matter, you haven't done anything wrong :
After you write the script, you publish it as a service. During the publishing process, you define who has access to the script.
In a Google Apps domain, you can publish the script so that only you have access or so that everyone in the domain has access.
In a Google consumer account, you can publish the script so that only you have access or so that everyone in the world has access.
If you need anyone outside your google apps domain to access your spreadsheet data you could install the script on a consumer account (that has sharing permission on the domain spreadsheet) and publish it from there.