Google Script - Move new submissions to another sheet based on the responses

后端 未结 3 1060
执念已碎
执念已碎 2021-01-07 04:39

I\'m trying to create a script that will take a new form response and move it to another sheet based on the information submitted. For example, let\'s say the form has two a

3条回答
  •  清酒与你
    2021-01-07 04:53

    Try something a little less broad in your comparing of variables,, For instance the sheet that submissions are sent to is a constant and already address.

    function formSubmission() {
     var s = SpreadsheetApp.getActiveSheet();
     var data = range.getValues(); // range is a constant that always contains the submitted answers
     var numCol = range.getLastColumn();
     var row = s.getActiveRow;
     var targetinfo = s.getRange(row,(Yourcolumn#here).getValue);
        if(targetinfo() == "Desired Sheet Name") {
          var targetSheet = ss.getSheetByName("Sheet A");
          var targetrow = targetSheet.getLastrow()+1);
          var Targetcol = numCol();
          targetSheet.getRange(targetrow,1,1,Targetcol).setValues(data);
         }
      }
    

    I didn't test that but hopefully it helps look up Event Objects in the developer guide i just recently found it and it clarifies a lot

提交回复
热议问题