Publish an add-on from Standalone Google Apps script - google-apps-script

I have developed a google sheet addon, I had succefully published that add-on from Google sheet bound script ie from tools->Script editor.
But If I made direct google apps script project(standalone project),I am unable to publish it,And a notification is popped up.
I research that I need it to setup it from google console,to publish standalone google app script to add-on ,But I don't found exact options to proceed.

The instruction is a very confusing for a first timer. Google keeps redirecting you to the page describing publishing editor addons, but what you really need is the page describing how to create a project on cloud platform.
https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project
Steps:
Create Project and get Project Number using instructions from link above
Go to you script. Select in the menu Resources > Cloud Platform projects... and enter your project number there
Then google will ask you to setup OAuth
After that, you can move your script to cloud platform and publish.

To publish an addon for G Suite Document editors follow the instructions here
https://developers.google.com/gsuite/add-ons/how-tos/publishing-editor-addons
The specific part about the GCP project is
Technical
The add-on script project must use a standard Cloud Platform (GCP) project. If the script project currently uses a default GCP project, you must switch to a standard GCP project. All collaborators working on the add-on should have access to the standard GCP project.

Related

Using external Web IDE in Google Appscript

I am creating an app for my company.
The thing is, I work on a governmental company and have several restrictions. I can use the google services including apps scripts and cloud services (the free services only) but ideally I can't install any IDE locally so I a web IDE would be the ideal solution.
But I am having a hard time to understand how can I export/import my scripts, I mean, I can't even find them on drive (I can find my project and that's it).
Some web based IDE's can be authorized, and some other will be blocked, this one: https://shiftedit.net/ seems to work.
I am just not understanding it?
Google Apps Script project files (.gs and .html) are not files that can be found in the Google Drive user interface. To export / download these files you could use Google Apps Script API, CLASP, Google Apps Script GitHub Assistant Chrome extension.
P.S. I just found https://github.com/dev-container/gas but have not tried yet... it' for working on Google Apps Script projects with VS Code and GitPod containers.
Related
How best to develop Google Sheets scripts and Git versioning
Is it possible to upload a .gs file to an apps script project of a copied google doc?

Cannot find Google Apps Script written before Google Workspace Marketplace

I wrote an extension for Google Docs that used to show up in the Add Ons menu for my organization. The add on no longer shows up in the menu, but I can see it in the Google Workspace Market. I originally had it on the Google Chrome Webstore, but then it moved to the Workspace Marketplace. I can also see the corresponding project in my Google Cloud Platform console.
However, when I go to the Google Apps Script Editor, my project is not there. I have no access to the source code or ability to fix it so that it will show up in the Add Ons menu again. Does anyone know where I might be able to find script? I have the URLs for the Workspace Market, but it is private to my organization, so no one will be able to view it.
Also, I tried going through Google Support but they said that App Scripts is not supported and to ask on Stack Overflow.
Edit:
Screenshot of error
Answer to rev 1
Open the Google Marketplace SD settings page on the Google Cloud project linked of your add-on. There you should find the script project id.
Then on your web browser open your Google Apps Script project by writing a URL like this:
https://script.google.com/d/<<put-here-the-script-project-id>>/edit
If the above doesn't work, see notes at the bottom
Resources
Publish an add-on
Enable and configure the Google Workspace Marketplace SDK
Related
How can I view the source of a google apps script Library
Library with identifier underscoreGS is missing
NOTES
If you get the message "Sorry, unable to open the file at this time", try again using Chrome on incognito mode with all the extensions disabled and signing in only with an account that has access to the Google Apps Script project.
If the above doesn't work either, follow the screen advice, wait a bit and try later.
Related
Google Drive Page Not Found - Sorry, unable to open the file at this time

How do I create a User-managed Cloud Platform project?

I created a script inside a Google Docs document. I want to use it in all my docs documents, so inside the script editor I clicked Publish -> Deploy as Docs add-on...
However, the following alert prompts:
What should I do in order to use my script?
Please check out the instructions that have been documented under:
Google Cloud Platform Projects > Switching to a different standard GCP project.
Sharing the steps here too, for reference:
Create a new Google Cloud Platform (GCP) project - instructions available here if you don't already have one.
in case you already have a GCP project configured, switch to that project via the cloud console.
Get the Project ID/number - instructions available here
Then go back to your script from the Apps Script browser editor and navigate to Resources > Cloud Platform project
In the Change Project section, paste the project number you copied into the text field, then click Set Project & finally Confirm on the subsequent page.
Personally, I had difficulties following through step 2 i.e. getting the project number so here's where you find it -

Custom Functions with add-ons?

I've been trying to create a Google Spreadsheet plugin from some existing Google App Scripts that I have, and one important part of this app script is Custom Functions.
Though the documentation for the add-ons doesn't indicate that this is supported, the documentation for Custom Functions does indicate that you can.
https://developers.google.com/apps-script/guides/sheets/functions
Through testing, I have not once been able to get Custom Functions exposed through a add-on. Does anyone know the secret sauce to get this to work?
Answer
According to Eric Koleda in [Code.gs - date_add_and_subtract]( https://github.com/google/google-apps-script-samples/blob/master/date_add_and_subtract/Code.gs) to make available the custom fuctions in an add-on it's required to include at least one add-on menu, but this is not working at this time on testing mode.
NOTE: The originally referred page was removed but the Date add and substract add-on sample code is available at https://github.com/googlesamples/apps-script/tree/master/sheets/dateAddAndSubtract.
The "solution" to test a custom function add-on is to publish the add-on privately so you could avoid the Google review of an untested add-on. Related Q&A: Publish an add-on privately
NOTES:
You have to create a Google Cloud Project, set OAuth Consent Screen, add the Google Workspaces Marketplace SDK, complete the configuration page, the listing page and to publish the add-on
Setting the OAuth Consent Screen for Internal Use requires to a Google Workspace Account
Setting the OAuth Consent Screen for External Use limited to test account only doesn't allow to publish the add-on to the GW Marketplace.
One scenario is to use different Google Cloud Projects for testing and production but use the same Google Apps Script project. Another scenario is to have two different Google Apps Script projects each one with their own Google Apps Project and someway copy the code from one to the other i.e. using Google Apps Script GitHub Assistant Chrome Extension, CLASP or the Google Apps Script API.
Remarks
There are a couple of related GAS issues, please star them:
"Test as add-on" from standalone project to Google Sheets doesn't link custom functions
After activating an add-on, custom functions get stuck Loading... until spreadsheet refresh

What happened to the "Publish to Gallery" option in Google Apps Script?

The Google Apps Script documentation claims:
"With the script loaded in the script editor click Publish > Publish to Gallery in the menu bar."
After starting a new script (for spreadsheets) project, I attempted to publish to the gallery. But there is no such option:
Was it recently removed? Do I need to change a setting somewhere?
I don't think it's available on Google Apps / business accounts. I've had to make a copy to a consumer account, then publish.