TRIM Function in ONLYOFFICE Spreadsheet Editor: Formula and Examples
Remove unwanted ordinary spaces at the beginning and end of an imported text value.
Verification status: Three specified ordinary-space, interior-tab and interior-nonbreaking-space cases were checked in ONLYOFFICE Desktop Editors Community 10.0.0.169 on Linux. Other whitespace positions and characters were not established by those tests. How formula examples are checked
Quick answer: =TRIM(A2) cleans spaces at the beginning and end of the sample ␠␠Maple Ridge␠␠, producing the expected value Maple Ridge. ONLYOFFICE’s official help describes TRIM as removing leading and trailing spaces from text; its one-argument syntax is TRIM(text). Official TRIM reference.
The concise help explicitly covers edge spaces. The source inspection and the native ordinary-space test below also support collapsing repeated interior ASCII spaces. Other whitespace needs separate treatment.
Availability and version history
- Introduced: The original introduction version and date are not established by the official sources checked.
- Availability: Documented in the current ONLYOFFICE Spreadsheet Editor help; no final working-version endpoint is established.
- Scope: Docs and Desktop Editors release separately. This unversioned help does not establish availability in every older build, mobile client or deployment.
- Checked: October 14, 2026, against the official function reference. Documentation and independent examples, plus the selected Desktop Editors Community 10.0.0.169 Linux cases identified below.
Exact ONLYOFFICE syntax and arguments
=TRIM(text)
| Argument | Mandatory? | Official meaning | Example |
|---|---|---|---|
text |
Required | A text value from which to remove spaces. | A2 or a quoted literal |
There is one argument: no second argument, no optional count, and no documented default when text is omitted. For a literal, use "Sample Text"; for a cell use A2. Do not type the placeholder word text in a real cell formula. The argument order and spelling come from the official TRIM entry, checked 2026-10-14.
Formula entry and locale
Type a leading =, the function name and parentheses. Quote a text literal, but do not quote a cell reference. ONLYOFFICE’s advanced settings let you choose formula language and regional number formatting. Use the local Function Arguments tooltip if your installation does not accept the English names or comma-separated nested formulas shown here.
Worked formula examples: leading and trailing spaces
Create a new blank worksheet and type the following into A1:A8. The character ␠ in the display represents one ordinary ASCII space: type a real space rather than the glyph. Text such as ␠␠ means type two real spaces.
| Cell | Visible input (␠ = one ordinary space) | Formula to put in B | Independently expected result |
|---|---|---|---|
| A1 | Raw label |
(header) | — |
| A2 | ␠␠Maple Ridge␠␠ |
=TRIM(A2) |
Maple Ridge |
| A3 | ␠Ottawa␠ |
=TRIM(A3) |
Ottawa |
| A4 | ␠␠Kingston |
=TRIM(A4) |
Kingston |
| A5 | East Region␠␠␠ |
=TRIM(A5) |
East Region |
| A6 | ␠␠ |
=TRIM(A6) |
"" (zero-length text) |
| A7 | East␠␠Region |
=TRIM(A7) |
East Region (source-snapshot expectation) |
| A8 | ␠␠north office␠␠ |
=TRIM(A8) |
north office |
- First enter A2 with exactly two leading and two trailing spaces. Place
=TRIM(A2)in B2. Expected B2:Maple Ridgewithout edge spaces. - Test
=TRIM(A3)and=TRIM(A4)to cover one or more spaces on only one side. Both are expected to lose the surrounding ordinary spaces while retaining the letters. - Check B6 with
=TRIM(A6); its expected empty string can look like a blank cell. If using the field as a mandatory value, distinguish an empty-looking formula result from an untouched blank input cell. - In B7 enter
=TRIM(A7). The independently expected result isEast Region: one ordinary space remains between the words. The official SDKJS implementation, together with its shared whitespace matcher, supports this ASCII case. The inspected source snapshot is dated May 19, 2026; it is not an execution test of every historical build.
Three native whitespace checks
These exact formulas were recalculated in Desktop Editors Community 10.0.0.169 on Linux:
| Formula | Observed result |
|---|---|
=TRIM(" A B ") |
A B, with one ordinary interior space |
=TRIM("A"&UNICHAR(160)&UNICHAR(160)&"B") |
A, two nonbreaking spaces, B; both U+00A0 characters remain |
=TRIM("A"&CHAR(9)&CHAR(9)&"B") |
A, two tab characters, B; both U+0009 characters remain |
The last two results each contain four characters, even if the spacing is hard to see. These are interior-whitespace tests, not a complete rule for leading or trailing Unicode whitespace, line breaks or every application version.
Advanced example: how many edge spaces were removed?
Enter in C2:
=LEN(A2)-LEN(TRIM(A2))
Expected C2: 4, because A2 contains two leading and two trailing ASCII spaces. Only length difference is being calculated; it does not prove the result is safe if A2 contains control characters or nonbreaking spaces. ONLYOFFICE LEN reference.
To prepare a display-ready label from A8, use =UPPER(TRIM(A8)). Expected: NORTH OFFICE after edge trimming and case conversion. ONLYOFFICE UPPER reference. Keep the input text unchanged for traceability.
Limits, errors and troubleshooting
- Repeated ordinary interior spaces: The source-backed A7 example and the native A/B test collapse repeated ordinary spaces to one. Check the target build when transferring an older workbook or when exact spacing is significant.
- Nonbreaking spaces, tab characters, line breaks and other invisible Unicode whitespace: The two interior NBSPs and tabs above survived the named desktop test. Line breaks and other positions or Unicode characters remain outside that result; inspect representative inputs before transforming a large import.
- Empty-looking results:
=TRIM(A6)is expected to return""for two ordinary spaces. A formula yielding empty text is not necessarily equivalent to an unfilled input cell for all subsequent logic; test downstream uses. - An unchanged result: Check that the suspected spaces really are leading or trailing standard spaces. The A7 example covers a repeated ordinary interior space, but it does not prove that every invisible character is removed.
- Formula error: Recheck
=TRIM(A2), notTRIM A2, verify a valid cell reference and closing parenthesis, and use quoted literals such as=TRIM(" Ottawa "). The exact error label has not been observed in a running ONLYOFFICE application. - Numbers and dates: Imported identifiers may be auto-typed. Format the source as text before input if leading zeros or exact strings must be retained; case/spacing cleanup cannot reconstruct information that import has already discarded.
What the documentation and source establish
ONLYOFFICE’s short help explicitly mentions edge spaces; the checked source additionally supports collapsing runs of ordinary interior spaces. A difference in how two vendors describe TRIM is not proof that their results differ. The native tests demonstrate that the tested interior tabs and nonbreaking spaces remain; other positions and whitespace characters are not established by those cases. Preserve raw imports and check representative values before applying cleanup to a whole column.
Related reading and site links
-
ONLYOFFICE COUNTIF: count categories after standardizing source values in a helper column; check that workbook’s matching logic separately.
-
Official ONLYOFFICE TRIM guide — source of this page’s purpose and exact syntax.