How can I access script property from new editor

294 views
Skip to first unread message

Takuma Hanaya

unread,
Jan 10, 2021, 1:08:50 PM1/10/21
to Google Apps Script Community
Hi, I'm new to google apps script, and I want to use new version of editor, not legacy editor.

I can find project property in file -> settings menu in lagacy editor, but cannot in new version.

Why? And where can I find it, thank you.

Alan Wells

unread,
Jan 10, 2021, 2:01:14 PM1/10/21
to Google Apps Script Community
To see, change or delete script properties you must either use the legacy editor,
or write some code and run it.
The Script Properties UI for the legacy editor has bugs in it.
It will display the properties, but it doesn't update or delete properties correctly.
You can log values to see what they are.

function getAllScriptProps() {

  var v = PropertiesService.getScriptProperties().getProperties();
  Logger.log(v)
}

Howard Burgess

unread,
Jan 11, 2021, 9:20:29 AM1/11/21
to Google Apps Script Community
This is the reason why I had to go back to the legacy editor as I do need to access the script props on my project. But when you swap back, the feedback form explicitly has a checkbox about script props missing, so it looks like Google knows it is missing and they probably didn't want to spend the effort, but the feedback form allows them to see how many people are likely to need it if they choose to add it back in. so ensure you tick that box on the feedback when you switch so Google is aware you need that functionality.

Alan Wells

unread,
Jan 11, 2021, 9:35:23 AM1/11/21
to Google Apps Script Community
I'm speculating that Google would like to omit the Script Properties UI from the new editor.
It's a permissions problem.
The internal permissions structure for how Properties Service data is accessed has changed.
The permission rules are now more compartmentalized and more secure, but that causes a greater challenge to access them.
And the underlying data storage structure probably changed.
When the legacy editor was developed they didn't have that problem.
Creating the UI to show a table of Script Property keys and values is easy, so that's not the issue.

Takuma Hanaya

unread,
Jan 11, 2021, 10:27:17 AM1/11/21
to Google Apps Script Community
Thank you. So now, using the legacy project property settings is not recommended I guess.

What do you think is the best way to do this, like managing environment variable (.env) in GAS projects? 

Howard Burgess

unread,
Jan 11, 2021, 10:35:05 AM1/11/21
to Google Apps Script Community
Well, if you just want to see/edit some props then as mentioned above you can write a new hidden function in the script to call ScriptProperties... to view/update them and write the contents to the log and you just click the run button and view them. That'll work happily in the new editor and if you only look/tweak them rarely, that's probably best for you.

Personally, I have a long term TODO in my code to look to see if I could move the script props to something else, maybe firebase, but I haven't started looking into that yet.

In my case, because I tweak the values often and I've got well over a dozen of them, but I develop in vscode and use clasp, it's just easier to stay in the legacy editor to allow quick access to the props for me.

Alan Wells

unread,
Jan 11, 2021, 11:39:05 AM1/11/21
to Google Apps Script Community
For the sake of anyone reading this thread who may not be familiar with Properties Service.
Under the category of Properties Service is:

Document Properties - documents are Sheets, Docs, Forms and Slides.
User Properties - restricted to the user
Script Properties - restricted to the Apps Script Project file

This discussion is specific to Script Properties.

I guess if someone wanted to create an HTML UI and open source it,
you could add it to your project, and then run it as a Web App.
That would give you a UI for managing Script Properties.
Of course, if the Apps Script project was already deployed as a Web App,
then you'd need to modify something to get the correct HTML to load.

So, I can't think of a great solution to this issue if the legacy editor ever gets deprecated,
or if they remove the Script Properties tab from the legacy editor.

I'm guessing that Google might add a Script Properties management UI that you open directly
from a list of your Apps Script files, rather than through a code editor toolbar item,
since the Script Properties are directly tied to the file itself.

Maybe that should be a feature request if Google hasn't already thought of it?

Takuma Hanaya

unread,
Jan 11, 2021, 12:38:02 PM1/11/21
to Google Apps Script Community
That would fit in my case because I just have a few properties.

> you can write a new hidden function in the script to call ScriptProperties

Thank you.
Reply all
Reply to author
Forward
0 new messages