My script was previously working with no issues, populating data once a day on the next row of its column (5). However, it stopped working. Now it will only work on a blank sheet with no previous data. The first two columns contain the same script though and are still working. Is this just a random bug? When it executes, it claims it did so successfully
function test() {
const ss = SpreadsheetApp.openById('sourceID');
const sh = ss.getSheetByName('forecast');
const data = [[sh.getRange('B126').getValue(),new Date()]];
const tss = SpreadsheetApp.openById('archiveID');
const ts = tss.getSheetByName('Archive');
ts.getRange(getColumnHeight() + 1, 5, data.length, data[0].length).setValues(data);
}
function getColumnHeight(col, sh, ss) {
var ss = ss || SpreadsheetApp.openById('archiveID');
var sh = sh || ss.getSheetByName('Archive');
var col = col || 5;
const rcA = sh.getRange(1, col, sh.getLastRow(), 1).getValues().flat().reverse()
let s = 0;
for (let i = 0; i < rcA.length; i++) {
if (rcA[i].toString().length == 0) {
s++;
} else {
break;
}
}
return rcA.length - s;
}