I’ve a Google Sheet that I’m making use of an onEdit
script to. That script (borrowed from right here) capitalizes all new entries in each discipline of all ranges of all sheets.
operate onEdit(e) {
if (typeof e.worth != 'object') {
e.vary.setValue(e.worth.toUpperCase());
}
}
Sadly, it eliminates 2 sorts of formatting which I want.
- Any formatting that I’ve utilized for dates will get eradicated, changing it with a 5-digit quantity (variety of days since time began)
- a discipline is pre-formatted as a p.c. If I sort a single-digit quantity, it robotically converts it to p.c. When the script acts upon it, reveals the worth as a decimal. For instance, I sort in 7, the pre-formatting makes it 7%, after which the script makes it 0.07
I attempted including conditional statements at first of the onEdit
operate, similar to:
if(or(typeof e.worth != 'object',not(isDate(e)))) {
However sadly that stopped the script from working in any respect.
How can I stop the onEdit
script from modifying dates and percentages?
Thanks!