I use Google App in my company, and I often have a prob when I update my script.
When I Update my script , my Webpage on Google sites is not updated , and for long time.
I must create a new script when I update my script.
Can I resolve this problem ?
regards
There are two ways to publish your code:
A) Either by deploying a new version, which is done as follows:
File -> Manage Versions
Add a new version -> Close dialog
Publish -> Deploy as web app
Select the version added -> Update
B) Or by always using your latest code
Publish -> Deploy as web app
Under the web app URL, click on the latest code button.
This way, any change done and saved will automatically be updated upon a refresh
Follow the instructions in the documentation. You need to first save a new version in the versions dialog. Then you need to re-publish it using the new version number.
Related
Each time I fix a bug I have to Deploy and update the Version
in the
console.cloud.google.com
I'm 17 Versions in and I don't think this is how it's supposed to work.
How do I switch back to Head so that I just Save the new code, reload my sheet, and work with the updated code?
I am the admin for the account, so I had published the Extension as an Add-On in the Marketplace so people on the team could see the Extension.
You can Test the add-on directly via 'Run' menu - 'Test as add-on' option.
Select the version on which you want to test and select the document.
Step 1
Step 2
I am trying to update a Google Sheets Addon.
I currently face 2 problems:
the new Script Editor does not know anything about versions (so I used the legacy editor and created a new version there)
when I want to deploy the changes (via the G Suite Marketplace SDK) I get an "Project Key is not associated with the current project or the script version doesn't exist." error when I enter the new version.
What should I do?
We have just rolled back to a previous version, can you refresh and try again? Please let me know how it goes.
I've got some Google Sheet script code that I'd like to extract into Google Sheet Addon to be published for just of our domain (not public web). Individuals on my team have been able to do this successfully in the past but after 1/25/2019 when Google removed Add-Ons from Google Chrome Store we've been having difficulties.
I am trying to follow:
https://developers.google.com/gsuite/add-ons/how-tos/publish-addons#publishing_instructions
But get the following error when trying to configure the G Suite Marketplace API:
Project Key is not associated with current project or the script version doesn't exist.
I am pulling the project Key from File --> Project Properties:
Does anyone have any idea where I am going wrong or know of good tutorial of how to publish a private Google Sheet Add-on?
I had the same problem but identified a solution as follows.
In the Google Apps Script Editor, under Resources -> Cloud Platform Project, click the ProjectName - project-id-xxxxxxxxxxxxxxxxxxx link. Then when it opens your Cloud Platform Project, in the upper left corner, your project name will be listed with a dropdown. Click the dropdown and verify that this project-id-xxxxxxxxxxxxxxxxxxx matches the link you clicked. The two numbers did not in my case and I had to refresh my screen for the correct project-id to show up in the Cloud Platform Project screen.
Don't know if this will help, but I was having the same error message and I just got it to work. I put in the value from File --> Project Properties: ->Project key (Deprecated) and still got the error. Then I changed the version to the number of my latest version and it worked.
Double check your version number - while in the script editor, click on 'File' and 'Project Properties'. I had the same problem. It turns out my error was entering the version name I had given my current version of the script (3.0), instead of the number Google had assigned to the current version of my script (3).
Once I entered '3' as the version number, I no longer got the error message "Project Key is not associated with current project or the script version doesn't exist ", and I was able to save.
I used the 'Project key (Deprecated)'.
The Project key has been deprecated. Try using the Script Id instead.
I created a web app for my google sheet script.
I deployed it with version 1 and and it works
Now I want to make on going changes and deploy my changes,
Do I need to increase the version for each change I deploy? or can I update on current version?
Also, is there a way to get the current version programmaticaly?
For your situation, I would like to introduce because I had a workaround that I also use.
For question 1 :
In generally, when the script of Web Apps was updated, the project version is required to be increased and Web Apps is redeployed with the new version.
But if you want to deploy Web Apps without increasing the version, as a workaround, you can achieve it by using a library. The flow of for this workaround is as follows.
Create 2 projects.
One is the project that Web Apps is deployed.
It supposes that this is the project that you are using now.
Another project is used as a library. Please create this as a standalone project.
Please create a version.
On script editor
File -> Manage versions...
After input description, please click "Save new version".
Please copy this script ID. This is used for installing the library.
For the project that Web Apps is deployed.
Please install the library project as a library.
On script editor
Resources -> Libraries...
For "Add a library", please input the file ID of library project.
Turn on "Development mode".
Set the version to the saved version.
In this sample, please set "Identifier" to "lib".
Please copy and paste the following function. In this project, the script is only this. And please save the project after copy and paste it.
function doGet(e) {return lib.main(e)}
Please deploy Web Apps as a new version.
After this setting, you are not required to modify this project.
For the project which is used as a library.
Please copy and paste the following function.
function main(e) {return yourfunction(e)}
yourfunction(e) is the function in the project that you are using.
In this workaround, when you want to modify the script, please modify the library project. By this, when the library is updated, the project which deployed Web Apps is automatically updated because "Development mode" is turned on when the library is installed. This update is also reflected to Web Apps. So the script of Web Apps can be updated without increasing the version.
As a sample, the scripts for both project after making the settings described above are as follows:
For the project that Web Apps is deployed.
function doGet(e) {
return lib.main(e);
}
For the project which is used as a library.
function main(e) {
return yourfunction(e);
}
function yourfunction(e) {
do something: The script which is run when users accessed to Web Apps.
return something
}
For question 2 :
In order to retrieve the current version of the project, you can use Apps Script API. This is also answered by tehhowch. In a recent update, users got to be able to retrieve and create the project versions. By using this, you can achieve this. The required scope is https://www.googleapis.com/auth/script.projects or https://www.googleapis.com/auth/script.projects.readonly.
The endpoint for retrieving the version list is as follows.
GET https://script.googleapis.com/v1/projects/### scriptId ###/versions
If you want to create the new version using script, you can use the following endpont.
POST https://script.googleapis.com/v1/projects/### scriptId ###/versions
Request body is
{
"versionNumber": 3,
"description": "sample description"
}
References :
Web Apps
Libraries
Google Apps Script API
Method: projects.versions.list
If this was not useful for you, I'm sorry.
When creating a web app for apps script, two links are given:
The one ending exec will only load the specified published version of the code.
The one ending dev will load the latest saved code (allowing for testing of code prior to making a new version).
Programmatic control of the deployed version is available via the Apps Script API, and to a Dev environment via clasp.
Getting versions
Creating versions
You need to increase the version for each change, unless you use the "dev" version of the app when it will always display the latest version. This will only be visible when you are logged into your account though.
It's much easier than everyone makes it sound
Go to Deploy:
Click "Manage deployments"
Under Configuration click the edit pencil
Under "Version" click "New Version"
Click "Deploy" it will auto increment the version for you
I am working on an add-on for the new Google spreadsheets but I wonder how versions are handled? In the old script gallery, there were versions. Are they working the same in add-ons after the add-on is published?
Also I see an auto generated Help submenu item. How do I generate content for it?
Thanks.
Thanks to #Steve Lieberman answer I see now how to choose on publish and update later the version of the add-on. But in the documentation I can't find an explanation of what will be the effect of updating to a new version on already used copies of the add-on. Will they be automatically updated? Will they receive in some form a notification of the new version?
Thanks.
When you publish your add-on [1], there's an option to select the version of the script that will be used.
Note there's also a version of the Chrome Web Store entry, this can differ from the version of the script.
The source code that is executed will be based on the version of the script that is published to the Chrome Web Store.
[1] https://developers.google.com/apps-script/add-ons/publish#publish_your_add-on
First create a new deployment/version of the script in the script editor.
Then update the script version in the Project's Google Workspace Marketplace SDK page, App Configuration tab (scroll down), then Save it.
Note that the update will take effect immediately when Saved, including for documents that are currently open in a browser.
Debugging: I don't think it's possible to have multiple deployments/versions of a Published Add-On active at the same. You have to do your debugging of the HEAD version in the Add-On's Host document, or in a document that does not have the Add-On installed (you can add the HEAD deployment of the Project as a script library in that case).