2
votes

I'm using a piece of Google Script to copy from one Google Sheet to another Google Sheet, but also doing some column and data manipulation (so it's not just a straight copy).

The code was inspired by this question: Event trigger to move row to one of two other sheets based on values in 2 columns

function onEdit(event) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.range;
...
}

Unfortunately it seems that when you check Multiple checkboxes in one go by highlighting multiple cells and pressing the space bar, the OnEdit event object will only detect the first cell as being edited, and the other cells not being edited.

I tested this by doing:

Browser.msgBox(event.range.getNumRows())

No matter how many Checkboxes I edit in one go; it always returns 1

Is there a correct way to get the true range of Cells edited in one go?

Thanks.

1
Looks like this is a bug specific to checkboxes and the space bar. I suggest filing a bug with the Apps Script team issuetracker.google.com/issues/…Diego

1 Answers

2
votes

This appears to be a bug!

I gave Google's Issue Tracker a look and it appears that this also happens when deleting multiple cells with checkboxes - only the range of the first cell is passed to e.range. Here's the report which details the same kind of behaviour:

It appears that this is an issue related to the way checkbox ranges are passed to the event object as well.

Google does seem to know about this issue but if it's causing problems you can file your own bug about it here as Diego mentioned above.

You can also hit the ☆ next to the issue number in the top left on the aforementioned pages which lets Google know more people are encountering this and so it is more likely to be seen to faster.

I hope this is helpful to you!