I Want OnEdit to clear the text from cell, but not the fill color or border in Google Sheets

Viewed 41

I'm using a drop down menu as a button and part of my Onedit trigger is to clear the contents from that cell. I only want it to clear the text, not the fill color or border of the cell, but I don't know how to do that.

function onEdit(e) {
  if (e.range.getA1Notation() == 'K5') {
    if (/^\w+$/.test(e.value)) {        
      eval(e.value)(submit);
      e.range.clear(submit);
    }
  }
}
1 Answers
function onEdit(e) {
  const sh = e.range.getSheet();
  if(sh.getName() == 'Your Sheet Name' && e.range.columnStart == 11 && e.range.rowStart == 5 && e.value) {
      e.range.clearContent();
}
Related