Most likely the inconsistency arises in the for
loop as you are using the same variable i
as iterator for both the main and inner loops, as a result the values overwrite. Change the second loop variable, for example to j
(and its references in the internal loop), for example:
for (var i=0;i<AllValues.length;i++){
var CurrentRow = AllValues[i];
var Id1 = CurrentRow[0]; //col with ID Sheet1
var kwota = CurrentRow[7]; //col with rate Sheet 1
Logger.log(CurrentRow);
for (var j=0;j<AllValues2.length;j++){
var CurrentRow2 = AllValues2[j];
var Id2 = CurrentRow2[0]; //Col with ID Sheet2
var kwota2 = CurrentRow2[12]; //Col with rate Sheet2
//Logger.log(Id2);
//Set Values
if (Id1 == Id2){
var setRow2 = j + FirstRow2;
docelowysheet.getRange(setRow2, 13).setValue(kwota);
//Logger.log(CurrentRow[7]);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…