I have a sheet with one button (a shape) which is associated with an Apps Script function.

enter image description here

When I click the button it inserts a row and activates a cell in that row.

enter image description here

Then if I try typing, nothing happens. I manually need to click on the new cell to be able to enter new text...

How can I change the code to be able to immediately start typing just after the click of the button (without additional click on the cell)?

function above_same_level() {
  var ws = SpreadsheetApp.getActive();
  var row = ws.getActiveRange().getRow();
  ws.insertRowsBefore(row, 1);
  ws.getRange('A' + row).activate();

1 Answer 1


A workaround is pressing Esc right after the mouse click on the button.

It's slightly more comfortable than using mouse, but it's still an intermediate step.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.