ReferenceFunctionsText Functions
TRIM
TRIM: Removes leading/trailing whitespace and collapses internal runs to single spaces.
Summary
Removes leading/trailing whitespace and collapses internal runs to single spaces.
Remarks
- Leading and trailing whitespace is removed.
- Consecutive whitespace inside the text is collapsed to one ASCII space.
- Non-text inputs are coerced to text before trimming.
- Errors are propagated unchanged.
Examples
Normalize spacing
Grid
| Cell | Value | |
|---|---|---|
| No inputs on Sheet1. | ||
Formula
=
Result
Not evaluated yet.
Expected
alpha beta
Already clean text
Grid
| Cell | Value | |
|---|---|---|
| No inputs on Sheet1. | ||
Formula
=
Result
Not evaluated yet.
Expected
report
Related functions
FAQ
What whitespace does TRIM normalize?
It trims edges and collapses internal whitespace runs to single spaces.
Runtime metadata
Category
Text
Signature
TRIM(arg1: Any)Arity
min 1, max 1
Arguments
arg1Any · Scalar
Caps
PURE
Source