Formula create on new ron insert google shgeets

Hi i am trying to add to rows togather when a new row is creted via Gile in google sheets

I need to add row D and Row E in Row F on a new entry but it keeps on replacing the formula or jumping to next light with no formula can soemone pelase help

I have found this script that works but i need to ammend it. I need to make sum on current row creation

Column D+E and answer comes on column F

function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();

function addFormula(e) {
var sheet = e.source.getActiveSheet();
var range = e.range;
var row = range.getRow();
var col = range.getColumn();
if (col == 1) {
var formula = "=SUM(IMPORTRANGE("\“,\“Sheet1!A\”&ROW()-1\”:B\“&ROW()))”;
sheet.getRange(row, 3).setFormula(formula);

I think you are making this much too complicated. You can simply use a Math column to do your calculation in Glide. No need to rely on formulas in your google sheet.

1 Like