Google-sheets – Submit response but not submit

google sheetsgoogle-forms

I have a form for timesheet, that each row is a different job description, job number, hours booked to job etc.

I have it so when you submit, it fills in the response sheet in order from top to bottom.

Problem I have is I want to run some functions set by a trigger that sends a copy of the sheet, then deletes the data and resets it so the new responses start at the top, but I only want this trigger to run after all the response lines are filled. So basically I use submit to send each response, but I have several responses to input before this can happen.

Is there a script that lets the response sheet rows be filled with the data as if submitted, but won't run the trigger until the final submition? If this makes sense.

Thanks

Best Answer

How to make out when the final response is received? Do you want to get exactly xx responses to trigger the event? Forms does not work like this.

It will much better if you can have a column with header "Updated". You can set up a trigger "on form submit" which will run when you receive a row. You can do whatever you want (like taking the values to a new sheet etc) and you can update the "updated" column with the date and time

function onFormSumbit(e) {

var item1 = e.source.getActiveSheet().getRange(e.range.rowStart,1).getValue();

var item2 = e.source.getActiveSheet().getRange(e.range.rowStart,2).getValue();

var item3 = e.source.getActiveSheet().getRange(e.range.rowStart,3).getValue();

//now do whatever you want (like populating a new sheet, send email etc)

//update a column in the sheet with today - mark it is processed. 

}