I'm attempting to set checkboxes within a specific range. The firebase_id array needs to correspond with column B in that range. If they match, the row should be set to TRUE. However, I am encountering issues where some checkboxes are randomly checked...
What could be causing this issue?
function verifyAndSetCheckboxesBasedOnFirebaseId() {
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
const testingSheet = spreadsheet.getSheetByName("Testing");
let firebaseItems = getSelectedIdsFromFirebase();
let firebaseIds = firebaseItems.map(function(item){return item.kinguinId}); // [ '17','2962','9798']
let lastRow = testingSheet.getLastRow();
let values = testingSheet.getRange("A2:B"+lastRow).getValues();
let rowNum = 1;
for(let i in values) {
let currentItem = values[i][1];
if(firebaseIds.includes(currentItem) === true){
testingSheet.getRange(rowNum,1).setValue("TRUE");
}
rowNum++;
}
}