Skip to main content
Solved

Script - remove whitespace from the beginning of the text

  • May 26, 2022
  • 3 replies
  • 52 views

" Hello Airtable"

  • need to remove initial white-space from the text in the script.

Best answer by Vivid-Squid

It sounds like you are putting this in the scripting block. This formula will only work in a Formula type column.

Without knowing what your script is you can try something like:

let text = "       Hello World!        ";
let result = text.trim();

3 replies

Forum|alt.badge.img+16
  • Inspiring
  • 529 replies
  • May 26, 2022

Hi @Ujval_Shah ,
You should be able to do this with a formula field with TRIM(string)


  • Author
  • Inspiring
  • 5 replies
  • May 26, 2022

Hi @Ujval_Shah ,
You should be able to do this with a formula field with TRIM(string)


It’s throwing error.

ReferenceError: TRIM is not defined at main on line 2


Forum|alt.badge.img+16
  • Inspiring
  • 529 replies
  • Answer
  • May 26, 2022

It sounds like you are putting this in the scripting block. This formula will only work in a Formula type column.

Without knowing what your script is you can try something like:

let text = "       Hello World!        ";
let result = text.trim();