This script will do this on all worksheets, if you want to do it only on a specific worksheet you will need to make some changes.
function onEdit(e){
const ss = e.source;
let value = e.value;
let range = e.range;
value = value.replace(new RegExp("[[áàâäã]", 'g'),"a");
value = value.replace(new RegExp("[[ÁÀÂÄÃ]", 'g'),"A");
value = value.replace(new RegExp("[[éèêë]", 'g'),"e");
value = value.replace(new RegExp("[[ÉÈÊË]", 'g'),"E");
value = value.replace(new RegExp("[[ìíîï]", 'g'),"i");
value = value.replace(new RegExp("[[ÌÍÎ]", 'g'),"I");
value = value.replace(new RegExp("[[òóôõöo]", 'g'),"o");
value = value.replace(new RegExp("[[OÒÓÔÕÖ]", 'g'),"O");
value = value.replace(new RegExp("[[ùúûü]", 'g'),"u");
value = value.replace(new RegExp("[[ÙÚÛÜ]", 'g'),"U");
value = value.replace(new RegExp("[[çÇ]", 'g'),"c");
value = value.replace(new RegExp("[[Ç]", 'g'),"C");
value = value.replace(new RegExp("[[ñÑ]", 'g'),"n");
value = value.replace(new RegExp("[[Ñ]", 'g'),"N");
range.setValue(value);
}
EDITED:
The code below works too.
function onEdit(e){
const ss = e.source;
let range = e.range;
let value = e.value;
let changeCase = {'a': '[àáâãäå]', 'ae': 'æ', 'c': 'ç', 'e': '[èéêë]', 'i': '[ìíîï]', 'n': 'ñ', 'o': '[òóôõö]', 'oe': 'œ', 'u': '[ùúûűü]', 'y': '[ýÿ]'};
for (i in changeCase) { value = value.replace(new RegExp(changeCase[i], 'g'), i); }
range.setValue(value);
};
Thank you very much. I’ll try
– Thiago