Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomatically drag formula in Google spreadsheet columns
    primarykey
    data
    text
    <p>I've a Google spreadsheet to which data is added from a fusion table using the script given in this <a href="https://github.com/jomcgrath2/Fusion-to-Spreadsheet" rel="nofollow">github link</a>. I added two more columns at the right end of the spreadsheet in which one is filled using formula </p> <pre><code> =COUNTIF(A$2:A$24,A2) </code></pre> <p>and other column by another formula. Currently, when every time the spreadsheet is updated with new rows, I am manually dragging the formula columns to update the data in them. Is it possible to update formula columns dynamically using script?. Ie, when the rows added the formula column also updated dynamically.</p> <p><strong>EDIT:</strong></p> <pre><code>// 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); }; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload