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

后端 未结 3 1061
执念已碎
执念已碎 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

    0 讨论(0)
  • 2021-01-07 05:05

    the triggers can be set by going to: then set it:

    0 讨论(0)
  • 2021-01-07 05:06

    I have a spreadsheet that collects the form submissions and then has extra sheets that have filtered out these submission based on the answers. All this is just with formulas. Could that do the trick also?

    0 讨论(0)
提交回复
热议问题