Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no apparent method to deploy ScriptProperties #569

Closed
junderw opened this issue Mar 12, 2019 · 8 comments
Closed

There is no apparent method to deploy ScriptProperties #569

junderw opened this issue Mar 12, 2019 · 8 comments
Assignees
Labels
feature request not feasible It isn't possible to build the feature

Comments

@junderw
Copy link

junderw commented Mar 12, 2019

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

@grant
Copy link
Contributor

grant commented Mar 12, 2019

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.

@erickoledadevrel erickoledadevrel added feature request not feasible It isn't possible to build the feature labels Mar 12, 2019
@erickoledadevrel
Copy link
Contributor

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.

@junderw
Copy link
Author

junderw commented Mar 12, 2019

that should be sufficient. Thanks!

@junderw
Copy link
Author

junderw commented Mar 13, 2019

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...

@labnol
Copy link
Contributor

labnol commented Mar 13, 2019

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

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

This is brilliant!

@erickoledadevrel
Copy link
Contributor

@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?

@junderw
Copy link
Author

junderw commented Mar 13, 2019

Do you have a document on how to do this?

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

@erickoledadevrel
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request not feasible It isn't possible to build the feature
Projects
None yet
Development

No branches or pull requests

4 participants