0
votes

Currently, I use onEdit and it is being called when I change values in a cell or range of cells, or when deleting, inserting rows/columns.

function onEdit(e) {
  Browser.msgBox('edit: ' + (e.range && e.range.getA1Notation()));
}

The onEdit function is not being called when hiding or showing a row through the UI.

Is there a way to get my script to be notified of a hide/show row event?

Update: I wrote a feature request for this in google-apps-script-issues: https://code.google.com/p/google-apps-script-issues/issues/detail?id=4670

Update: As per Kriggs answer, the installable trigger onChange can be used

Here's how that works. enter image description here

However, on the e (event) object, there's no range property from which to see what row/range was hidden or shown. Also Krigg's suggested Row method does not exist on e.source.

How can we leverage onChange to also get the row number(s) hidden or shown?

1

1 Answers

1
votes

I just found out about onChange(), which handles specifically changes to structure in the Sheet, and aparently must be activated in the Trigger menu and then choosing a function. To know the ROW you can use just as onEdit(), e.source.Row();.

I tested a little bit and found it to be as erratic as time based and onEdit(), out of 3 consecutives hiding only 1 was Logged.