Hidden field in a Google Form

后端 未结 5 1163
面向向阳花
面向向阳花 2020-11-30 02:52

I am adding a unique ID to each submission of the form. Right now, I made that ID the first field, and pre-filled it with the ID, along with a help text asking the user not

5条回答
  •  心在旅途
    2020-11-30 03:48

    I think I've found a solution to your problem. A script on the sheet that your form data is going to can be triggered on form submit. You can then copy and increment a "range" for each row submitted.

    *edit, sample code was requested. In order for this code to work you need to "install a trigger" using the resources menu on your google app script, and use "from spreadsheet" "on form submit". I've boiled what I'm doing down to the following snippet.

    function myFormUpdates(e) {
      var spreadsheet = SpreadsheetApp.getActive()
      //select the sheet you're form is going to post data to
      var sheet = spreadsheet.setActiveSheet(spreadsheet.getSheets()[1])
      //select the last row and a unused column
      var cell = sheet.getRange(sheet.getLastRow(), 3)
      //set data
      cell.setValue('Data')
    }
    

提交回复
热议问题