Clasp: There is no apparent method to deploy ScriptProperties

Created on 12 Mar 2019  路  8Comments  路  Source: google/clasp

Expected Behavior

There should be a way to push / pull ScriptProperties from the Script.

Actual Behavior

There is no obvious way to do this besides opening it in the browser editor and doing File > Project Properties

Steps to Reproduce the Problem

  1. Read documentation on this repo.
  2. Find no method to deploy script properties.

Specifications

  • Node version (node -v): v10.15.0
  • Version (clasp -v): 2.0.1
  • OS (Mac/Linux/Windows): Linux myhost 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
feature request not feasible

Most helpful comment

As Grant mentioned, it isn't feasible to build this given the limitations of the Apps Script API that clasp uses. You could add a helper function to your script like:

function setProperties(properties) {
  PropertiesService.getScriptProperties.setProperties(properties, false);
}

And then call clasp run from your environment, passing in the properties to set:

clasp run 'setProperties' '[{"foo": "bar"}]'

I don't think it makes sense to build this into clasp however, so closing this issue as not feasible.

All 8 comments

I think you mean Properties via PropertiesService.


https://developers.google.com/apps-script/reference/properties/script-properties

> This class is deprecated and should not be used in new scripts.

Maybe you can use clasp run to use that method. There's no API to access these properties. I'm not sure your use-case, but perhaps you could just use a Sheet to access properties instead.

As Grant mentioned, it isn't feasible to build this given the limitations of the Apps Script API that clasp uses. You could add a helper function to your script like:

function setProperties(properties) {
  PropertiesService.getScriptProperties.setProperties(properties, false);
}

And then call clasp run from your environment, passing in the properties to set:

clasp run 'setProperties' '[{"foo": "bar"}]'

I don't think it makes sense to build this into clasp however, so closing this issue as not feasible.

that should be sufficient. Thanks!

Looks like clasp run can't be used with scripts that are attached to google forms, as running them gives me

Script API executable not published/deployed.

And trying to click "Publish as executable API" give me an error popup of "Can not retrieve script execution endpoint information" (I am translating from Japanese, no clue how to switch back to English)

oh well...

And then call clasp run from your environment, passing in the properties to set:

clasp run 'setProperties' '[{"foo": "bar"}]'

This is brilliant!

@junderw - There should be no problem publishing a form-bound script as an executable, and I just tested it myself. Maybe it was a transient error? Perhaps check to make sure there is nothing strange in your manifest?

Do you have a document on how to do this?

Manifest file? (This is my GAS deployment knowledge level)

This is the documentation on how to setup the execution API:

https://developers.google.com/apps-script/api/how-tos/execute

I'm not sure what problem you are running into, so hard to advise, other than say hack around and try different things.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arichardsmith picture arichardsmith  路  6Comments

hariharasuthan-balaji picture hariharasuthan-balaji  路  8Comments

DominikPalo picture DominikPalo  路  4Comments

dskeithbuck picture dskeithbuck  路  5Comments

dustinmichels picture dustinmichels  路  4Comments