Reputation: 11
From the active cell that I get the rank, I want to select the cells of this row of column H to V, then copy the same line to the end of the sheet, whatever the end of the sheet.
function deBugEssaiMaj() {
var ss = SpreadsheetApp.getActive();
var sh = ss.getActiveSheet();
var laPremiereLigne = sh.getActiveCell().getRow();
var source = sh.getRange("G"&laPremiereLigne&":V"&laPremiereLigne);
};
I have an error:
range not found
Upvotes: 1
Views: 236
Reputation: 1568
What is definitely wrong is the &
-operator. It is not used for concatenation of strings in JavaScript. You have to use +
var source = sh.getRange("G" + laPremiereLigne + ":V" + laPremiereLigne);
With &
it is also valid JavaScript, but does not make any sense. It is used for bitwise and operation, which is not defined for strings. So the strings are converted to numbers resulting in NaN
. NaN
bitwise anded with anything yields 0
, so you basically called getRange(0)
Upvotes: 3