Michael SM
Michael SM

Reputation: 715

Google Apps Script - how to get the deleted row in onEdit script, or onDelete?

I need to get the row number and the content for the deleted row in onEdit trigger script. or is there an onDelete function?

Basically, when user deletes one row or a range of rows, the script should be notified the range deleted, in some way.

Upvotes: 4

Views: 2963

Answers (2)

Marco
Marco

Reputation: 31

If user deletes one cell this works:

function onEdit(e) {
    if (e.value==e.source.getActiveSheet().getActiveCell().getValue()) {
        //Things to do for normal edition
    } else {
        //Things to do if cell was deleted
        deleted_range = e.range
    }
}

I'm not shure if that's the right solution but works fine until now. For multiple cells i can't find a solution yet :/

Upvotes: 3

Henrique G. Abreu
Henrique G. Abreu

Reputation: 17772

This is not possible. There's a feature request opened regarding this, you may want to star it to keep track of updates and kind of vote for it.

Issue 1363: Add trigger for spreadsheet column or row operations

Upvotes: 2

Related Questions