Google Sheets function
TRIM function in Google Sheets
TRIM in Google Sheets removes leading and trailing spaces and reduces repeated spaces between words to one. It does not remove every type of whitespace character. Use TRIM to clean copied names, labels, and other text before comparing or joining values.
Source: Google Docs Editors HelpLast verified Nov 5, 2026
Syntax
=TRIM(text)Arguments
| Argument | Required | What it means |
|---|---|---|
text | Yes | The text whose extra spaces should be removed. |
Examples
Remove spaces around a label
| A | |
|---|---|
| 1 | Status |
| 2 | Draft report |
=TRIM(A2)Result: Draft report
TRIM removes the spaces before and after the label.
Common mistakes
Expecting TRIM to remove every nonprinting character.
Use CLEAN as well when imported text contains nonprinting characters.
Removing spaces that are intentionally part of a code.
Apply TRIM only when extra spaces are not meaningful data.