What is the best way to handle this?
No native way to prevent it, you might be able to prompt your way to an entry like that using the Custom component though.
Or you can use a JavaScript function to clean the carriage returns from a string, something like.
return p1.replace(/[\r\n]+/g, '')
Which means replacing all carriage returns and line feed/newline (I assume you might not want those as well) with an empty string.
Thank you, I used REGEXREPLACE(B2:B;ā/[\r\n]+/gā;āā) as arrayformula in Google Sheets.
It might be cleaner to handle this in a Glide JavaScript column instead of Google Sheets, since it avoids cross-platform dependency and keeps the logic closer to the app.
I am not familiar with Glide Javascript, would this be appropriate?
if (!p1) return āā; return p1.toString().replace(/\r|\n/g, āā).trim();
The REGEX solution will clean up old line breaks, This will prevent new, thank you!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.