LEFT
- LEFT(input_string, length)[source]
Returns a substring consisting of the leftmost characters from a string.
This function mimics the behavior of Excel’s LEFT function. It extracts a substring from the start of input_string, up to the number of characters specified by length. Both singular values and arrays are supported. If any argument is blank or in an error state, the formula evaluates to an error.
- Parameters:
- Return type:
- Returns:
The substring consisting of the leftmost characters of input_string up to index. If either input is an array, an array of substrings is returned.
- Raises:
ValueError – if input_string is not of type STRING or STRING_ARRAY.
ValueError – if index is not of type INTEGER or INTEGER_ARRAY.
Examples
Basic usage:
LEFT("Hello World", 5) # Returns "Hello"
Using a Field or Formula:
LEFT(customer["name"], 3) # Returns first three characters of the customer's name
With array input:
LEFT(["Apple", "Banana", "Cherry"], 2) # Returns ["Ap", "Ba", "Ch"]
``input_string`` — accepted types
STRING
STRING_ARRAY
``length`` — accepted types
INTEGER
INTEGER_ARRAY
Return types
STRING
STRING_ARRAY