Help with replacing formulas in cells after an even is run.

20 views
Skip to first unread message

Stuart Eade

unread,
Oct 25, 2024, 6:17:48 AMOct 25
to Google Apps Script Community
Example sheet:

Hopefully, it explains all on the sheet.

In a nut-shell, I have a script that needs adjusting so that formulas can be copied back into the cells they were originally in, after an event is run.

Please take a look.

Best regards
manc

Keith Andersen

unread,
Oct 25, 2024, 3:38:24 PMOct 25
to google-apps-sc...@googlegroups.com
Stuart,
Just clear cell D1 - this removes all previous data to start again.

function menuItem1() {
var ss = SpreadsheetApp.getActive();
var srcSheet = ss.getSheetByName("Sheet1");
var dstSheet = ss.getSheetByName("dstSheet");
var data_range1 = srcSheet.getRange('U2:AD2');
var data_data1 = data_range1.getValues();
var data_clean1 = data_data1.filter(function (r) {return r[0]});
var lr1 = dstSheet.getLastRow();
dstSheet.getRange(lr1+1, 1,data_clean1.length,10).setValues(data_clean1);

srcSheet.getRange("D1").clearContent();
}

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/f6694247-0902-4abb-96a8-73dccc5160fen%40googlegroups.com.


--

Passions: God, Family, Friends, Scripture, Data Management, Google Sheets + App Script, MS Access, Programing, sharing and much more.
Reply all
Reply to author
Forward
0 new messages