Answer the question
In order to leave comments, you need to log in
How to find the starting position for deleting selected rows?
Good evening! I need to delete the selected row, but I don't know how to find the first parameter (row number) in the deleteRows method. Please help me who understands!
function myFunction() {
var sheetActive = SpreadsheetApp.openById("18TC8ShpPeMr5NcIwahUIl58wQIIt8qeECcM21ECMGIE");
var sheet = sheetActive.getSheetByName("ДАННЫЕ");
// The code below logs the background active_Range for the active range.
var active_Range = SpreadsheetApp.getActive().getActiveRange();
let active_RangeValues = active_Range.getValues();
active_RangeValues.forEach(function(item){
sheet.appendRow(item)
})
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Лист1");
// Rows start at "1" - this deletes the first two rows
sheet.deleteRows(1, active_RangeValues.length);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question