Tengo el siguiente script que multiplica las celdas en 4 columnas diferentes (22, 26, 28 y 29) y debo ingresar los totales en la columna 36 para cada una de las filas correspondientes; sin embargo, no sé cómo establecer los valores en las filas de la columna. 36. La línea las dsh.getRange(2, 36, data.length, data[0].length).setValues(netTotal); Creo ser incorrecto. Su ayuda es muy apreciada. Gracias
const dss = SpreadsheetApp.openById('1YfkGTaKsZN_QlQpR901Gxfr7sc_Hxrs3wlL0u08RUm8'); const dsh = dss.getSheetByName("CONCRETE"); const lr = dsh.getIndex(); const lQ1 = dsh.getRange(2, 22, dsh.getLastRow() - 1, 17); var data = lQ1.getValues(); var netTotal = [] for (i in data){ var row = data[i]; var multiply = row[0] * row[4] + row[6] * row[7] netTotal.push([multiply]) Logger.log(netTotal) } dsh.getRange(2, 36, data.length, data[0].length).setValues(netTotal); } function myfunk() { const ss = SpreadsheetApp.openById('1YfkGTaKsZN_QlQpR901Gxfr7sc_Hxrs3wlL0u08RUm8'); const sh = ss.getSheetByName("CONCRETE"); const vs = sh.getRange(2, 1, sh.getLastRow() - 1, sh.getLastColumn()).getValues(); vs.forEach((r,i) => { sh.getRange(i + 2,36).setValue((r[21] * r[25]) + (r[27] * r[28])); }); }o
function myfunk() { const ss = SpreadsheetApp.openById('1YfkGTaKsZN_QlQpR901Gxfr7sc_Hxrs3wlL0u08RUm8'); const sh = ss.getSheetByName("CONCRETE"); const vs = sh.getRange(2, 1, sh.getLastRow() - 1, sh.getLastColumn()).getValues(); let vo = vs.map(r => [(r[21] * r[25]) + (r[27] * r[28]}]); sh.getRange(2,36,vo.length,vo[0].length).setValues(vo); }