Home > OS >  Move row based on cell value in Google Forms response sheet
Move row based on cell value in Google Forms response sheet

Time:05-19

I have a Google Spreadsheet with 2 sheets (Study Results & Form Responses). I am trying to write a script to automatically move the new answers from the Google Form to the Study Results sheet every time a new form is submitted, based on the cell value in Column A of the Study Results sheet matches the cell value in Column B of the Form Response sheet.

I would only like to transfer the Form answers in Column D to Column J, not all of the columns from the Forms sheet.

I have tried searching similar questions and scripts on here but have not found a successful script. I'm honestly not completely sure if this is possible or not, but I'm just trying to see if anyone knows a way to automate this or has any advice in general.

CodePudding user response:

Moving answers to Study Results

function onFormSubmit(e) {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName("Study Results");
  let a = e.values;
  a.shift();
  sh.appendRow(a);  //Puts all of the answers into Study Results sheet.  If you want in a different order then explain that order
}
  • Related