'Why isn't this variable range's data changing with the new variable set?
Why doesnt the logged data change with the variable ranges data?
Im trying to build a function that will cycle through a column and will stop once it passed the end date.
function january() {
var i = 6;
var x = 1;
var cellPos = theList.getRange(i, x);
const start = new Date("01/01/2022");
const end = new Date("01/31/2022");
var loop = cellPos.getValue();
while (loop < end){
Logger.log(loop);
var i = i+1;
Logger.log(i);
Logger.log(loop);
}
}
Log:
Info Mon Jan 03 00:00:00 GMT-05:00 2022
Info 7.0
Info Mon Jan 03 00:00:00 GMT-05:00 2022
Info Mon Jan 03 00:00:00 GMT-05:00 2022
Info 8.0
Info Mon Jan 03 00:00:00 GMT-05:00 2022
Info Mon Jan 03 00:00:00 GMT-05:00 2022
Info 9.0
Info Mon Jan 03 00:00:00 GMT-05:00 2022
Solution 1:[1]
function january() {
var i = 6;
var x = 1;
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh = ss.getSheetByName("Test");
var data = sh.getDataRange().getValues();
//var cellPos = theList.getRange(i, x);
//const start = new Date("01/01/2022");
var end = new Date("01/31/2022");
var loop = data[5][0]; // Cell row 6 column 1
while (loop < end){
Logger.log(i);
loop = data[i][0]; // Starts at 6
Logger.log(loop);
i = i+1;
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | TheWizEd |