The documentation for the PropertiesService lists both, the ScriptProperties and UserProperties as:
Deprecated. This class is deprecated and should not be used in new scripts.
... while the DocumentProperties seem to have no page in the documentation.
Q: is there any suitable replacement for these classes, in order to use them in new scripts?
The replacement for the deprecated classes is the class Properties.
PropertiesService has three methods getDocumentProperties(), getScriptProperties(), and getUserProperties(). Perhaps once upon a time these returned objects of those deprecated classes; but now they all return an object of class Properties.
Script properties, user properties, and document properties remain available and they are non-deprecated; it's just that the classes have been unified into Properties.
var sp = PropertiesService.getScriptProperties();
sp.setProperty("foo", "bar");
var up = PropertiesService.getUserProperties();
up.setProperty("foo", "baz");
var dp = PropertiesService.getDocumentProperties();
dp.setProperty("foo", "blargh");
Logger.log([sp.getProperty("foo"), up.getProperty("foo"), dp.getProperty("foo")]);
logs [bar, baz, blargh].
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