1// Sets several script properties, then retrieves them and logs them.
2
3// Initialize the service
4let documentProperties = PropertiesService.getDocumentProperties();
5// Set the properties
6documentProperties.setProperties({
7 'cow': 'moo',
8 'sheep': 'baa',
9 'chicken': 'cluck'
10});
11// Retrieve the properties
12let animalSounds = documentProperties.getProperties();
13// Loop through the properties and log them
14for (var kind in animalSounds) {
15 console.log('A %s goes %s!', kind, animalSounds[kind]);
16}
17// Logs:
18// A chicken goes cluck!
19// A cow goes moo!
20// A sheep goes baa!