0

I have a google spreadsheet that connected to the google form, this form has the name, family name, email address and... questions.

I want my spreadsheet takes name and family name and combine them and put them in the desired column each time someone submits a form.

for example, I submit a form with name: ExampleOne, family name: ExampleTwo; this two value go to row 2, column A in sheet 1 and row2, column B in sheet 1 I want this to combine them and the spreadsheet put them together in row 2, column K.

I don't know js well so if you want to tell me a solution with the script, please write it with good details.

thanks so much.

0

1 Answer 1

0

In addition to copying this code into your Script editor, it should be configured as an Installable onFormSubmit trigger.

The code takes advantage of the Event Objects. The sequence of events is:

  1. when the form response is submitted, the variable "newname" is created from the values of the response
  2. the target range for Column K is defined. Note: the row number is obtained from the event objects.
  3. the "newname" value is set into the target range.

function wa13510501(e) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheetname = "Form Responses 1";
  var sheet = ss.getSheetByName(sheetname);
  // Logger.log(JSON.stringify(e)); // DEBUG
  var newname = e.values[1]+" "+e.values[2];
  var namerange = sheet.getRange(e.range.getRow(),11);
  namerange.setValue(newname);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.