I have a column with phone numbers.
Most of them have a "normal" format -> 999111999111
Then, I have some numbers in the format +65 999 222 999 222, and google sheets is returning "Formula parse error" and showing #ERROR. even if the value can be seen if you click on it.
I can fix it by manually deleting the spaces, but need to automate it.
When in google scripts I use.getvalue(), automatically get the #ERROR. string and can´t manipulate the string using regex.
Any idea how can I fix the error?
Use the built-in Find & Replace feature activate the Use Regular Expressions checkboxes to replace all the starting +
(the regular expression to use is ^\\+
). It's opt to you to replace them by an empty string (just left the replace box empty) or replace it by '+
in order to force that the cell value be parsed as text instead of a formula.
An alternative from the side of Apps Script is to use getFormula
instead of getValue
.
Find ^
(start of line) and replace with '
(denoting that the following is a string and not to be parsed)
Make sure to check "search using regex" and "inside formulas".
Just use find and replace and change =+ with '+
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.