Remotely update Sheets on client-side with new Library version - google-apps-script

I've an question about libraries usage within Google Sheets.
I developed a standalone Apps Script published as Library. This library is used by 150 Google Sheets files (I did that to centralize and hide some code from users).
Today, I need to update the library code to add some functionalities.
I'd like to know if you know a solution to remotely update the 150 Sheets Clients to match the new Library version on client side (I don't use the "dev" mode).
It seems that the Apps Script API can change do changes on the library itself but not on the client side (sheets).
Has someone else had this issue and how did you deal with it ?

Nope. You'll have to do it yourself. Libraries not in dev mode never auto-update, and can't be updated to the latest version by the library developer, because they are libraries -- it is expected that there is code in the destination that uses it, and thus it is not guaranteed that changing the version does not break the interface code.
If you want your deployed code to be auto-updated to the latest version, you should be using the add-on model, or (when you know that you will have backwards compatibility for your library interface) accessing your libraries from your scripts in dev mode.
You can collect the requisite Script IDs (File -> Project Properties) that need to have the library updated, and you can update the Script Project contents (including the appsscript.json manifest file that specifies the library version) via the Apps Script API. You may find clasp helpful for this.

Related

Can't switch google cloud project on GAS Editor

I am not able to switch google cloud platform project in GAS editor.
What I am doing is…
Open the google sheet GAS editor
Open Resource --> Cloud Platform Project
Enter project number that I want to connect
With the process above, I was able to switch a cloud platform project but now it returns an error
‘Project does not exist, or you need edit access to it.’
I am using the same cloud project and same account(editor) that I used before and properly worked. I tried do the same with a owner account, but it didn’t work, either.
Also, this cloud project is not a default project nor a hidden project. (If it does, I guess it should not be able to access through GAS editor from the beginning)
I have checked documentation below, but it tells me only case when switching to a hidden project.
https://developers.google.com/apps-script/guides/cloud-platform-projects
Does anyone have a solution or suggestion??
Thank you for the help in advance.
Problem Solved.
I figured out that OAuth IDs which are generated when make connection docs to the cloud project are not be deleted even though delete actual document files.
What I have done is...
Login Google Cloud Platform
Go to APIs&Services --> Credentials
On OAuth 2.0 client IDs, delete unnecessary contents from the list
Back to your docs and switch the cloud project.

Where can I find Google Maps v3 markermanager.js

It appears that markermanager.js is no longer available on googlecode.com which has been closed. I have looked for an equivalent on Github, but so far without success. I can find marker-clusterer etc. but my code is built to run with markermanager.js.
Can anyone tell me where it has gone, please?
Following Google's move of the source, the new GitHub version can be accessed via jsDelivr (a content deliver network with no bandwidth limits that's focused on performance, reliability, and security) by using the following script urls (standard and packed versions):
https://cdn.jsdelivr.net/gh/googlemaps/v3-utility-library#markermanager/1.2/markermanager.js
https://cdn.jsdelivr.net/gh/googlemaps/v3-utility-library#markermanager/1.2/markermanager_packed.js
These urls specifically target the 1.2 release of the markermanager library - as covered in the following SO answer, in production you should consider targeting a specific release tag to ensure you're getting a specific release version of the script:
Link and execute external JavaScript file hosted on GitHub
Alternatively, you could download and include the library directly in your project for production purposes.

Google App Script add files to zip archive with zero compression

Is there any way using google app script to add file to zip archive with zero compression? I only found class Utilities with method zip. However there is no parameters which allows to control compression levels or any other parameters of archive.
Google App Script is a light-weight JavaScript based cloud scripting language to automate certain tasks and build web applications. Stressing on the word, "light-weight". Hence, it does not provide certain (or should say, all) functionalities as JavaScript does(or at least made possible through importing libraries) and unfortunately, ability to control compression ratio is one of them. However, you can file this as a Feature Request on the Public Issue Tracker.

Adding Google Charts or Similar to Chrome Packaged App

I have a Chrome Packaged App that I want to be able to graph data for the user. I would ideally like to interface with something along the lines of the Charts/Visualization API, but I'm trying to find a solution that will work offline, possibly through integration with other apps or within my app specifically. Is there a way to insert a Google Chart or something very similar into my packaged app? Is there an API or feature I am unaware of that would make this feasible?
Unfortunately the Google Charts library cannot be downloaded for inclusion in a packaged app due to their terms and conditions:
Sorry; our terms of service do not allow you to download and save or host the google.load or google.visualization code.
- Google Charts FAQ
That said, there are many excellent Javascript libraries that are available for download which you could include with your packaged app and use as if they were included from a remote source.
This stack overflow question should help you decide between the various options. You should then download the Javascript files for the library you chose and place them within the folder of your packaged app and then use them like any local Javascript that you've written.

Version control for Google Apps Script GUI Builder UI

I have published a Google Apps Script as a web app (Let's say it's Version 1 in 'Manage Versions'), I am now working on code for a new version. The issue I have is any changes to the GUI Builder UI for the new version are immediately applied to the published web app version, which naturally causes a lot of problems for current active users as they have Version 1 code (good) mixed with yet-to-be-published GUI Builder components (not good). How do I get GUI Builder to align with the Google Apps Script version control? Thanks, John
Hmm, I think there is something missing in the gas version-managment regarding the things built with gui-builder, maybe you should file an issue for that (google-apps-script-issues), seems to be not yet reported.
As a workaround 1 (as there seems to be no way to copy a gui inside the gui-builder), you could just make a copy of the project when you are ready to publish a new version and just publish the copy to your users (drawback: key changes, so you have to update your users with a new link to the app)
Workaround 2 could be to copy your guis into a separate library and have as code a single function like
function getComponent (app, guiName) {
return app.loadComponent(guiName);
}
which you then use from your project to load the gui. This means each time you want to create a new release, you copy your project, replace all the source-code in this copy with the above function and reference that copy as library from your project.
This library then has to reference the original project as library too and you have to update the event-handlers inside the gui builder to point to that original handlers in your project. Made a short test and it seems to work, but what a mess...