Имам електронна таблица на Google, към която се добавят данни от обобщена таблица с помощта на скрипта, даден в тази гитхъб връзка. Добавих още две колони в десния край на електронната таблица, в която едната е попълнена с формула
=COUNTIF(A$2:A$24,A2)
и друга колона по друга формула. В момента, когато всеки път, когато електронната таблица се актуализира с нови редове, ръчно плъзгам колоните с формули, за да актуализирам данните в тях. Възможно ли е колоните с формули да се актуализират динамично с помощта на скрипт?. Т.е., когато редовете се добавят, колоната с формула също се актуализира динамично.
РЕДАКТИРАНЕ:
// evaluate project type and set identifier
function addCountIfFormulaToCell(){
// add the id of your spreadsheet here
var sss = SpreadsheetApp.openById('0AozvCNI02VmpdG5tb0pkUGdDR3djMm5NV0pYeThFbGc');
// add the name of the sheet here
var ss = sss.getSheetByName('Sheet1');
// column you want to evaluate for the formula
var columnToEvaluateAgainst = "A";
// column you want to add the formula to
var columnToAddFormulaTo = "H";
// identifies the last row
var lastRow = ss.getLastRow();
// is the cell to evaluate in the last row
var evaluateThisCell = columnToEvaluateAgainst + lastRow;
// is the cell that gets the forumla in the last row
var addFormulaToThisCell = columnToAddFormulaTo + lastRow;
// this is my formula
var projectFormula = "COUNTIF(A$2:$A,A2)";
// grabs the cell that gets the forumla in the last row
var ssCellToGetFormula = ss.getRange(addFormulaToThisCell);
// sets the formula to the cell in the last row
ssCellToGetFormula.setFormula(projectFormula);
};