I essentially want to activate a script that says
b[i]=b[i]+f[i]
For each value of [i] in a row. Is there a way for me to do this in a loop? Below is the super inefficient code I currently have (I have a small data set of 5, so I can get away with it for now) and I want it to be in a loop format instead so that it can support scalability and etc.
function Update() {
//update A
var Ax = SpreadsheetApp.getActiveSheet().getRange('B2').getValue();
var Ay = SpreadsheetApp.getActiveSheet().getRange('D2').getValue();
SpreadsheetApp.getActiveSheet().getRange('B2').setValue(Ax+Ay);
//update B
var Bx = SpreadsheetApp.getActiveSheet().getRange('B3').getValue();
var By = SpreadsheetApp.getActiveSheet().getRange('D3').getValue();
SpreadsheetApp.getActiveSheet().getRange('B3').setValue(Bx+By);
....
}
EDIT: I also have functions on many cells within the range that I do not want to remove.