In the Google Apps Script editor, I can set a user property by opening the File > Project properties menu, and then selecting the "User properties" tab. However, it seems that the PropertiesService is unable to access the values set in this menu. Is there a way I can access the values set through this menu in my script?
Set {"propertyA", "valueA"} in "User Properties" tab (pictured below)
Run PropertiesService.getUserProperties().getProperties()
Output: {}
If I were to then run PropertiesService.getUserProperties().setProperty("propertyB", "valueB");
and then getProperties()
again, the output would update to show only {propertyB=valueB}
.
Similarly, as my searches all direct me to the PropertiesService, where can I find documentation about these menu properties? (Specifically, I'd like to know when I should use the menu option versus setting the values programatically.)
No. The GUI for accessing user properties was never updated when the UserProperties class was deprecated in 2014. The issue was finally resolved with the redesigned Apps Script IDE in 2020, which removed the GUI for accessing properties altogether.
Although it is possible to access the legacy IDE and modify script properties via the menu, the only way to access user properties is programmatically with PropertiesServices.getUserProperties()
. Google has also published a guide to the Properties service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With