FLATARRAY / FLATTEN
Creates an array of all supplied values, flattening any arrays so that the array is a single array of values.
Syntax
=FLATARRAY(value1, value2, ...)
=FLATTEN(value1, value2, ...)
Arguments
Argument | Type | Description |
---|---|---|
value | Any | The value for the specified item, values can be different types |
Examples
=FLATARRAY(123)
→[123]
Creates a flattened array from the value 123
=FLATARRAY("A", 2, true)
→["A", 2, true]
Creates a flattened array from the values "A", 2, and true
=FLATTEN(1, ARRAY(2, 3), 4)
→[1, 2, 3, 4]
Creates a flattened array from the value 1, an array containing 2 and 3, and the value 4. Because the array values are flattened, the final array consists of all elements (without arrays): 1, 2, 3, 4.
=FLATTEN(1, ARRAY(2, ARRAY(3, 4)))
→[1, 2, 3, 4]
Creates a flattened array from the value 1, an array containing 2 and and array containing the values 3 and 4. Because the array values are flattened, the final array consists of all elements (without arrays): 1, 2, 3, 4.
Updated 4 months ago