Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I read the User properties saved in the File/Project properties menu?

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?

  1. Set {"propertyA", "valueA"} in "User Properties" tab (pictured below) "User Properties" tab

  2. Run PropertiesService.getUserProperties().getProperties()

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

like image 577
Diego Avatar asked Jan 18 '18 03:01

Diego


1 Answers

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.

like image 85
Diego Avatar answered Oct 14 '22 05:10

Diego