I used google script to generate a list of forms with the same structure but different content. I would like to collect the responses for each form and merge them into a single google sheet. Is there any way to do so in google scripts?
0
votes
1 Answers
0
votes
A solution would be having the same script in each Form. Use the Form submit event to add a new row in the same Sheet every time a user submits a response. All the scripts can reference the same Sheet by using the Id with the openById(id) method.
Then, the simplest way to put the data into the sheet would be using the appendRow method.
For example:
function onFormSubmit(e) {
var sprSheet = SpreadsheetApp.openById('your sheet id');
var sheet = sprsheet.getSheetByName('your sheet name');
//Store the values from your form
var values = {value1: e.namedValues['formValue1'][0], value2: e.namedValues['formValue2'][0]};
//This would write value1 and value2 into Columns A and B respectively
sheet.appendRow([values[0].value1, values[0].value2]);
}
You might also take a look at the Quickstart to manage Responses for Google Forms.
query
function, or a script might create a sheet holding the static results of the various responses. Which do you want? – Tedinoz