Deployed Google Apps Script Add-on only works through individual install - google-apps-script

I made an Apps Script for Google Sheets and published it as an editor Add-on for my company domain. Its one custom function and when I did an individual install for myself it works fine. And when anyone else in the org does an individual install it works fine. However when installing it for the whole company via Admin Console, the Add-on doesn't work and gives the following error unknown function. So I want to know what am I missing that is preventing this Add-on from working.

So after like 5 hours of not understanding what's going and not being able to find the solution. I figured it out. In the spreadsheet I had to go to Add-Ons -> Manage Add-Ons and on the Add-On I made there were the 3 vertical dots (options) and right clicking reveals a panel that says "Use in this document". Though a minor inconvenience - every time someone in the org creates a new spreadsheet and wants to use functions from the plug-in, they will have to do just that. Hope this helps.

Related

Simple function suddenly throws "An unknown error has occurred, please try again later"

Since today morning, I am getting the below message while trying to run new App scripts on a new Google sheet.
Error An unknown error has occurred, please try again later.
My other App scripts attached to existing Google sheets continue to run fine. But if I create a new sheet and add even a plain simple function as shown below and try to execute this, I get the above error after it attempts to run it for some time and then gives up.
function Mytest()
{
}
I suspect that it is not able to bring the permission box which it use to bring up for any new script created. Till yesterday, once the permissions dialog box comes up and I used to give the permissions, the scripts use to run fine. But today it is not even bringing up the permission dialog box.
It looks like there is a outage going on with Google Apps Script when running new projects. I can see a couple of people reporting it in Google's public issue tracker.
It looks like it is only affecting new projects but most old projects are running fine. In the meantime you can add more info to the report to bring more attention to it. I have made some tests in 4 different accounts from different organizations and I can confirm I am also affected by this.
A couple users are reporting that it started to fix itself, and it looks like clearing cache and cookies from the browser may solve the issue (this is not a definitive solution but may work for you).
Only happens with Apps Script-managed Google Cloud Platform projects. Seems okay if you manually set the GCP project with the id using Resources > Cloud Platform Project...
I tried this because mine started with this error:
We're sorry, there was an unexpected error while creating the Cloud Platform project. Error code DEADLINE_EXCEEDED
I was having the same issue. Adding the script ID to the Library seemed to fix it.
Go to the "settings" option in the left menu of the script editor and copy the script id. Then click the plus icon next to the "Library" option and click "look up". Once the script is found, click "add" and run the script.

Unable to set project name in the "grant permissions" dialog for Google Apps Script Add-on

I have an add-on for Google Sheets that's currently being tested within my domain. For this post, let's call it My First Add On. When users install the add-on they're prompted for permissions, but it always appears as "Untitled project" in the dialog box:
The project name is set to My First Add On everywhere I can find:
The Google Apps script project name
The Google Cloud Platform project name (IAM > Settings)
The Google Chrome Web Store add-on name (Developer Dashboard)
My add-on is published with 'private' visibility, available only to people in a given Google Group (my trusted testers).
I've searched through documentation and forums to see what I'm missing here, but can't find anything that covers this scenario.
This has to be something basic, but I'm completely stuck and the only support option available to me is to post here. I'd be grateful for any help, folks!
I've seen something similar, where the name of the script isn't updated if you test it before saving the name (ie, create a name when prompted rather than before testing). Try clearing your cache, closing out of the tab, etc, and then launching again. I'm not sure it's something you can fix in code or listings anywhere.

Google Apps Script published add-on stopped working post chnages

I have a published Add-on in web store for Google Docs. I have also been able to make changes to it and re-publish to web store couple of times in past.
But when I made a recent change to add-on, it won't allow me to test as Add-on again. Only error I am getting is:
"There was a problem testing the script as an add-on. Please try again later."
I see in Google's Issue tracker that such problems have been reported but for Add-on for Google Sheet where Sheet being tested was deleted was causing the issue.
https://issuetracker.google.com/issues/36763685
I have used different Apps script projects to test the code before copying it to published Add-on. Now I am not able to get Select Document screen either.
Same Apps-script project if copied and run as Add-on, it works fine, but not published version. Since this is already a web store published add-on, I need to make this version work.
Any pointers will be of great help. Thanks!

Google docs install my own addon without publishing [duplicate]

I have just made an addon for Google docs, successfully tested it and now I would like to use it. It's very simple, it just shows the id of the current document.
This is the most important part of the script, just called by the onOpen(e) function:
DocumentApp.getUi().alert(DocumentApp.getActiveDocument().getId())
When I tested it by the Publish/Test as addon (I am not sure with English titles, I translated the button names from Czech) it works exactly as I want.
How can I use it the same was as I would download it from the webstore? I don't want to publish it, because it isn't much useful for others and I would have to follow the rules, wich Google wants. Is it possible?
You can publish it privately.
This way you can publish it instantly (google doesn't need to review it), it's only visible and install-able by you, and you don't have to pay the developer fee.
In the Chrome Web Store developer Dashboard:
Developer Dashboard
You can add an "Item" to be published as a draft. Then, you can edit the item before publishing it. At the very bottom of the "Edit Item" page, there are 3 settings for visibility options. The last one is "Private"
An Apps Script bound to a Doc runs the onOpen() function without publishing the script as an Add-on, or Deploying the bound script as a web app. Publishing an Add-on, and deploying a web app are two totally different things. But, you don't even need to do either of those. All you need to do, is open the Doc that the Apps Script is bound to, and the onOpen() function will run. Also, you don't need the e argument in onOpen(e). That's for an event parameter.
Something else that's interesting is group based publishing:
Group-Based Publishing in the Chrome Web Store
You can not by pass the payment process i suppose. As earlier comments mentioned; you can pay the developer fee (as i remember it was like a 5 dollars) and publish it as private. So nobody can see and install it.
But if you want to use as test you can run the script as test on a document. Select the "Run->Test as add-on..." menu and you have to select a document. After selecting and openning that document you will see very long text on address bar like this:
https://docs.google.com/document/d/your_document_id/edit?addon_dry_run=bla_bla_bla
So just take the
?addon_dry_run=bla_bla_bla
part after the
https://docs.google.com/document/d/your_document_id/edit
and paste to your other documents :) Your add-on menu will work. But i can not guarantee if that works for only your account or a security leak! Use at your own risk.

Deploying my custom Google Sheet

I have been searching for an answer, more that likely using the wrong terminology, to my question and I have read through the Google documentation but I am now more confused than when I started looking for the answer.
I'm new to Google Apps and a complete beginner at Javascript. I recently started working in a Google Apps school (we have our own domain) and I have started developing some custom Google Sheets to aid other teachers and boost productivity.
I have developed a Sheet with some custom scripts and a custom menu bar to call the various functions of the script. Since I am so new to Javascript my scripts have some bugs that I fix as other users report them to me. However, my problem is that when I fix a bug in my "master" Sheet the end user must open the shared master Sheet and make a copy of it to benefit from the update. I want to update to be pushed out to all copies of the sheet (circa 4 copies)
I know need to deploy it but I don't know whether I need to deploy it as a web app or a sheets add-on from the script editor? Again, we have our own domain so I do believe I don't need to have it approved by Google to use it internally in our domain?
Based from this documentation, public add-ons require a review before publication, since you have your own domain, you can publish just for users within your domain without a review.
To publish an add-on for the first time, follow these steps. If you also want to let Google Apps domain administrators install and authorize your add-on for all users in their domain, follow the steps for domain-wide publication as well.
When you fixed your bugs and wanted it to be updated to all copies of sheets, you can follow this Update your add-on link to update an add-on that you have already published.
Open the add-on project in the script editor.
Make the necessary changes to your code, then save a new version of your project by clicking File > Manage versions, then Save
New Version. Close the Manage Versions dialog.
Click Publish > Deploy as add-on. (Or Sheets or Docs or Forms add-on.)
In the dialog that appears, change the add-on's details as needed, select the new version of your script, then click Update store
item. (If you change the add-on's name, make sure you also change
the name of the Apps Script project to match, as the project name is
shown in the authorization dialog.)
In the store listing, click Publish changes, then click OK in the dialog that appears.
Hope this helps!