Hello!
I am a beginner with JavaScript and have been taking courses for a few months. I have a couple of scripts I have written so far that are up and running. I have an issue that I can’t get past which is very important to find a resolution for, so I’m hoping someone can help.
I have google survey’s that are being submitted and an on even form generator script that creates a form and produces a link in google sheets. The problem I’m having is that I need to be able to filter forms that belong to certain person on to a different spreadsheet using a script. I have written the script a few ways to try to achieve this but have been unsuccessful. The script works as intended but it removes the form generator links when it’s copied or moved.
Here is the filter script I had written:
function myFunction() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var trn = ss.getSheetByName(“Hull-NY”);
var originalData = trn.getRange(2, 1, trn.getLastRow()-1,12).getValues();
var centerManager = “Brooks,Robert”;
if(trn.getColumn() == 3 && trn.getValue() == “Brooks,Robert”){
var r = originalData.getRow();
var data = originalData.filter(function(item){ return item[1] === centerManager;});
//var row = centerManager.getRow();
//logger.log(data);
var targetSheet = ss.insertSheet(centerManager);
targetSheet.getRange(2, 1,data.length,data[0].length).setValues(data).getLastRow();
}
I appreciate any help that could be provided!