OBJECT

Creates an object that can be queried by key. Arguments are passed in as either an array of key-value pairs or as paired key and value parameters.

Syntax

=OBJECT(key1, value1, key2, value2, ...)

=OBJECT(keyvalues)

Arguments

ArgumentTypeDescription
keyNStringThe key for the key-value pair. If the key is a non-string it will be converted to a string type
valueNAnyThe value for the specified key. Values can be different types
keyvaluesArrayAn array of key-value pairs. Each element in the array should be an array with two values, the first representing the key and the second representing the value.

Examples

=OBJECT("A", 2){"A": 1}
Creates an object consisting of the key "A" which maps to the value 1

=OBJECT("A", 1, "B", 2){"A": 1, "B": 2}
Creates an object consisting of the key "A" which maps to the value 1, and the key "B" which maps to the value 2.

=OBJECT(ARRAY("A", 1), ARRAY("B", 2)){"A": 1, "B": 2}
Creates an object consisting of the key "A" which maps to the value 1, and the key "B" which maps to the value 2