I am trying to set a new calculated column based on values of two other columns. The condition is: whenever I insert new data in columns C and D, the column E should be calculated as "=C/D".
This would be the equivalent of this in pandas:
df['new']= df['C']/df['D']
but I do not know if JS supports this no-iteration feature Pandas offers
I tried this but nothing happens:
function sample(){
var sheet=SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheet2');
var range=sheet.getRange('E2:E20000')
for (i=0; i<range.length; i++){
if (i==''){
i.setFormula(`=${C[i]/D[i]}`);
}
else {
pass
}
}
}