The current implementation of the TRIM function just "String.trim()" the input. This is not enough. Indeed, a quick test within Excel of Office 365, shows that this function also reduces duplicated spaces between words to simple ones. So this behavior should be replicated within the TextFunction class. Test case: Just add the following line in TestTrim.testBasic(): confirmTrim(new StringEval("hi there"), "hi there"); This bug applies to the 4.1.2-FINAL version too. On a sidenote, the online documentation does not mention this specific behavior: https://support.microsoft.com/en-us/office/trim-function-410388fa-c5df-49c6-b16c-9e5630b479f9 I have sent them a feedback on this matter. The inline documentation is fortunately correct, at least the French one.
change made in r1891851