Skip to main content
deleted 2 characters in body; edited title
Source Link
serenesat
  • 10k
  • 30
  • 33
  • 50

Issues with Google scriptScript on collecting Form responses and moving to another sheet

I have been trying to piece together some code for a task at work using Google sheetsSheets and I am having some issues with what I can find versus my current knowledge level. I am trying to create a script that will collect responses from a Form, move them to the last row of a separate sheet, and then clear the row.

function onEdit(event) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.source.getActiveRange();

  if(s.getName() == "Form Responses 2" && r.getColumn() == 1 && r.getValue() > 0) {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("TestEnd");
    var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
    s.getRange(row, 1, 1, numColumns).moveTo(target);
    s.deleteRow(row);
  }
}

This code works only when manually changing the data in column A but does not work when data is submitted via the Form response. I would greatly appreciate any help that is offered.

Issues with Google script on collecting Form responses and moving to another sheet

I have been trying to piece together some code for a task at work using Google sheets and I am having some issues with what I can find versus my current knowledge level. I am trying to create a script that will collect responses from a Form, move them to the last row of a separate sheet, and then clear the row.

function onEdit(event) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.source.getActiveRange();

  if(s.getName() == "Form Responses 2" && r.getColumn() == 1 && r.getValue() > 0) {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("TestEnd");
    var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
    s.getRange(row, 1, 1, numColumns).moveTo(target);
    s.deleteRow(row);
  }
}

This code works only when manually changing the data in column A but does not work when data is submitted via the Form response. I would greatly appreciate any help that is offered.

Issues with Google Script on collecting Form responses and moving to another sheet

I have been trying to piece together some code for a task at work using Google Sheets and I am having some issues with what I can find versus my current knowledge level. I am trying to create a script that will collect responses from a Form, move them to the last row of a separate sheet, and then clear the row.

function onEdit(event) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.source.getActiveRange();

  if(s.getName() == "Form Responses 2" && r.getColumn() == 1 && r.getValue() > 0) {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("TestEnd");
    var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
    s.getRange(row, 1, 1, numColumns).moveTo(target);
    s.deleteRow(row);
  }
}

This code works only when manually changing the data in column A but does not work when data is submitted via the Form response. I would greatly appreciate any help that is offered.

improved formatting, added tag
Source Link
marikamitsos
  • 13.1k
  • 4
  • 34
  • 59

Issues with Google Scriptscript on Collectingcollecting Form Responsesresponses and Movingmoving to Another Sheetanother sheet

I have been trying to piece together some code for a task at work using Google Sheetssheets and I am having some issues with what I can find versus my current knowledge level. I am trying to create a script that will collect responses from a Form, move them to the last row of a separate sheet, and then clear the row.

function onEdit(event) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.source.getActiveRange();

  if(s.getName() == "Form Responses 2" && r.getColumn() == 1 && r.getValue() > 0) {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("TestEnd");
    var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
    s.getRange(row, 1, 1, numColumns).moveTo(target);
    s.deleteRow(row);
  }
}

This code works only when manually changing the data in column AA but does not work when data is submitted via the Form Reponseresponse. I would greatly appreciate any help that is offered.

Thank you.

Issues with Google Script on Collecting Form Responses and Moving to Another Sheet

I have been trying to piece together some code for a task at work using Google Sheets and I am having some issues with what I can find versus my current knowledge level. I am trying to create a script that will collect responses from a Form, move them to the last row of a separate sheet, and then clear the row.

function onEdit(event) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.source.getActiveRange();

  if(s.getName() == "Form Responses 2" && r.getColumn() == 1 && r.getValue() > 0) {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("TestEnd");
    var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
    s.getRange(row, 1, 1, numColumns).moveTo(target);
    s.deleteRow(row);
  }
}

This code works only when manually changing the data in column A but does not work when data is submitted via the Form Reponse. I would greatly appreciate any help that is offered.

Thank you.

Issues with Google script on collecting Form responses and moving to another sheet

I have been trying to piece together some code for a task at work using Google sheets and I am having some issues with what I can find versus my current knowledge level. I am trying to create a script that will collect responses from a Form, move them to the last row of a separate sheet, and then clear the row.

function onEdit(event) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.source.getActiveRange();

  if(s.getName() == "Form Responses 2" && r.getColumn() == 1 && r.getValue() > 0) {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("TestEnd");
    var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
    s.getRange(row, 1, 1, numColumns).moveTo(target);
    s.deleteRow(row);
  }
}

This code works only when manually changing the data in column A but does not work when data is submitted via the Form response. I would greatly appreciate any help that is offered.

Source Link

Issues with Google Script on Collecting Form Responses and Moving to Another Sheet

I have been trying to piece together some code for a task at work using Google Sheets and I am having some issues with what I can find versus my current knowledge level. I am trying to create a script that will collect responses from a Form, move them to the last row of a separate sheet, and then clear the row.

function onEdit(event) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.source.getActiveRange();

  if(s.getName() == "Form Responses 2" && r.getColumn() == 1 && r.getValue() > 0) {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("TestEnd");
    var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
    s.getRange(row, 1, 1, numColumns).moveTo(target);
    s.deleteRow(row);
  }
}

This code works only when manually changing the data in column A but does not work when data is submitted via the Form Reponse. I would greatly appreciate any help that is offered.

Thank you.