您好 我调试出来问题了,设置公式时候需要清空再进行设置
//设置列公式
//sheet.isPaintSuspended(true);
var sTable = sheet.findTableByName("gcTable0");
sTable.setColumnDataFormula(4, '');
sTable.setColumnDataFormula(8, '');
sTable.setColumnDataFormula(12, '');
sTable.setColumnDataFormula(4, '=AVERAGEIF(([@Col_1],[@Col_2],[@Col_3]),">0"');//如果只计算当前行的列 前面加@ 否则是指的整个列
sTable.setColumnDataFormula(8, '=AVERAGEIF(([@Col_5],[@Col_6],[@Col_7]),">0"');
sTable.setColumnDataFormula(12, '=AVERAGEIF(([@Col_9],[@Col_10],[@Col_11]),">0"'); |