Retrieving a Key with Maximum Value from Object
Gists This sample script is for retrieving a key with the maximum value from an object. This can be also used by Google Apps Script. var obj = {"a": 5, "b": 4, "c": 3, "d": 2, "e": 1}; var res = Object.keys(obj).reduce(function(a, c) { return obj[a] > obj[c] ? a : c; }); Logger.log(res); // >>> a