In GDocs under Tools > Preferences, I can define automatic corrections, so that if I type l*
, it spells low, h*
-> high, etc.
In Google Spreadsheet there is nothing like that. Can I do that with script? How?
google sheetsgoogle-apps-scriptgoogle-apps-script-triggers
In GDocs under Tools > Preferences, I can define automatic corrections, so that if I type l*
, it spells low, h*
-> high, etc.
In Google Spreadsheet there is nothing like that. Can I do that with script? How?
Best Answer
As Eddy told you, it can be done by using the onEdit trigger.
Code
Explained
The script will first check if the preference sheet has been modified. If
yes
, then it will clear/remove the cache. After that, it will either retrieve all the data from the references sheet or the cache. Then it will determine which shortcut is to be used, by means of thematch
andregex
. If the criteria are met, the With column value will be added.Copy the spreadsheet I've prepared and look under Tools, Script editor. There you will find the script. Press the bug button to validate/authenticate the script.
Example
I've created an example file for you: Script to automatically change text value
Note
*
. Multiple leading characters are allowed (see example).Edit (28-12-2013)
The regex, to match the replacement text, was all wrong. Added possibility to change the replacement text from within sentence.