Replace values with Google Sheets AppScript

197 views
Skip to first unread message

Miguel De los Santos

unread,
Oct 21, 2022, 9:24:06 AM10/21/22
to Google Apps Script Community
Good morning:

This time I have a spreadsheet in Google Sheets, in which in column "A", users will be entering their identity document. Ideally, numerical or alphanumeric values should be entered in the case of foreign documents. But, many times these users paste the data from other forms, so they may come with special characters ("." ;","; "-"; "_"). The idea is that when the user enters a data, a macro is run, which removes the format of that entire column, cleans it and eliminates those special characters, only leaving numbers and letters to have.

The easy step is to do it with a formula in a contiguous column, the formula is REGEXREPLACE(), but already the document becomes heavier and such. That's why I wanted to use the macro option, since it would be acting on the same value of the cell and reducing it in many cases.

I still have no knowledge of Appscript and have been searching on Youtube / Stackoverflow, but I did not find anything.

Could you help me create this macro?

I thank you very much for being so!!!

Miguel.-

Tanaike

unread,
Oct 21, 2022, 9:33:13 PM10/21/22
to Google Apps Script Community
Reply all
Reply to author
Forward
0 new messages