I have created a table in my google sheet, where days refers to columns and rows refers to trials.
Day 1 = [O, O, X, X]
Day 2 = [O, O, X, X]
However, I want to replace all "O" with some value. These values differ per day.
Example: numVal1 = 88 and numVal2 = 99.
For day 1, all O must be replaced with 88.
For day 2, all O must be replaced with 99.
The output must be something like this:
Day 1 = [88, 88, X, X]
Day 2 = [99, 99, X, X]
I'm using a for loop to do this but it's taking too long to finish if I'm working on too many data.
My code is:
for (var i = 1; i <= data.length + 1; ++i){
for (var j = 1; j <= data[0].length + 1; ++j){
var item = ws.getRange(i,j).getValue();
if(item !== "X"){
let numVal = ws.getRange(6, j).getValue();
ws.getRange(i,j).setValue(numVal);
}
}
}