Skip to main content
styled body text, retagging
Source Link
Jacob Jan
  • 23.3k
  • 16
  • 106
  • 195

When I receive submissions from a form I am trying to find a way to include my formulas and set values in the same row as the information submitted by form.

  My form is only collecting 14 values but my data sheet for the form responses is 45 columns wide.

I I am getting recorded weight measurements from the form. These come over and I need to subtract the weight of the container that the recorded weight from the form came from, then I need to show that weight.

I have tried adding a script to the spreadsheet.

function onFormSubmit(event) {
  Logger.log("Event: " + event.changeType);
  Logger.log("New row added");
  var sheet = event.range.getSheet();
  var addedRowIdx = event.range.getRow();
  Logger.log("Index of new row: " + addedRowIdx);
  var range = sheet.getRange(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
    14, 15, 16, 17, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 
    sheet.getMaxRows(), 1); // 4 == fourth column == c
  var queryColumnFormulas = range.getFormulasR1C1();
  for (var i = 1; i < queryColumnFormulas.length; i++) {
    if (queryColumnFormulas[i][0] == "") {
      Logger.log("Inserting formula in row " + i);
      queryColumnFormulas[i][0] = queryColumnFormulas[i - 1][0]; // Copy formula from previous row
      queryColumnFormulas[i][0] = queryColumnFormulas[i - 1][0]; 
    }
  range.setFormulasR1C1(queryColumnFormulas);
  }
}

I found this in a previous answer and added my column numbers where values or formulas are stored but I am getting an error.

ERROR MESSAGE:
TypeErrorTypeError: Cannot read property "changeType" from undefined. (line2, file"Code")

Here is a link to the spreadsheet: https://docs.google.com/spreadsheets/d/134Jhn2accw5pa8D8K5IWZZ5w0FgXVIbJNLaEuVOsdrI/edit#gid=1014589054

Here is a link tospreadsheet and here the form: https://docs.google.com/forms/d/1uMbhcGfh9eowGZi-hJRcWanOfHxEi8nq_6NRUdfi4kU/editform.

When I receive submissions from a form I am trying to find a way to include my formulas and set values in the same row as the information submitted by form.

  My form is only collecting 14 values but my data sheet for the form responses is 45 columns wide.

I am getting recorded weight measurements from the form. These come over and I need to subtract the weight of the container that the recorded weight from the form came from, then I need to show that weight.

I have tried adding a script to the spreadsheet.

function onFormSubmit(event) {
  Logger.log("Event: " + event.changeType);
  Logger.log("New row added");
  var sheet = event.range.getSheet();
  var addedRowIdx = event.range.getRow();
  Logger.log("Index of new row: " + addedRowIdx);
  var range = sheet.getRange(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, sheet.getMaxRows(), 1); // 4 == fourth column == c
  var queryColumnFormulas = range.getFormulasR1C1();
  for (var i = 1; i < queryColumnFormulas.length; i++) {
    if (queryColumnFormulas[i][0] == "") {
      Logger.log("Inserting formula in row " + i);
      queryColumnFormulas[i][0] = queryColumnFormulas[i - 1][0]; // Copy formula from previous row
    }
  range.setFormulasR1C1(queryColumnFormulas);
  }
}

I found this in a previous answer and added my column numbers where values or formulas are stored but I am getting an error.

ERROR MESSAGE:
TypeError: Cannot read property "changeType" from undefined. (line2, file"Code")

Here is a link to the spreadsheet: https://docs.google.com/spreadsheets/d/134Jhn2accw5pa8D8K5IWZZ5w0FgXVIbJNLaEuVOsdrI/edit#gid=1014589054

Here is a link to the form: https://docs.google.com/forms/d/1uMbhcGfh9eowGZi-hJRcWanOfHxEi8nq_6NRUdfi4kU/edit

When I receive submissions from a form I am trying to find a way to include my formulas and set values in the same row as the information submitted by form. My form is only collecting 14 values but my data sheet for the form responses is 45 columns wide. I am getting recorded weight measurements from the form. These come over and I need to subtract the weight of the container that the recorded weight from the form came from, then I need to show that weight.

I have tried adding a script to the spreadsheet.

function onFormSubmit(event) {
  Logger.log("Event: " + event.changeType);
  Logger.log("New row added");
  var sheet = event.range.getSheet();
  var addedRowIdx = event.range.getRow();
  Logger.log("Index of new row: " + addedRowIdx);
  var range = sheet.getRange(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
    14, 15, 16, 17, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 
    sheet.getMaxRows(), 1); // 4 == fourth column == c
  var queryColumnFormulas = range.getFormulasR1C1();
  for (var i = 1; i < queryColumnFormulas.length; i++) {
    if (queryColumnFormulas[i][0] == "") {
      Logger.log("Inserting formula in row " + i);
      // Copy formula from previous row
      queryColumnFormulas[i][0] = queryColumnFormulas[i - 1][0]; 
    }
  range.setFormulasR1C1(queryColumnFormulas);
  }
}

I found this in a previous answer and added my column numbers where values or formulas are stored but I am getting an error.

TypeError: Cannot read property "changeType" from undefined. (line2, file"Code")

Here is a link to the spreadsheet and here the form.

added 17 characters in body
Source Link
Alex
  • 22.8k
  • 12
  • 83
  • 104

I am getting recorded weight measurements from the form. TheseThese come over and I need to subtract the weight of the container that the recorded weight from the form came from, then I need to show that weight.

I have tried adding a script to the spreadsheet. function onFormSubmit(event) { Logger.log("Event: " + event.changeType); Logger.log("New row added"); var sheet = event.range.getSheet(); var addedRowIdx = event.range.getRow(); Logger.log("Index of new row: " + addedRowIdx); var range = sheet.getRange(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, sheet.getMaxRows(), 1); // 4 == fourth column == c var queryColumnFormulas = range.getFormulasR1C1(); for (var i = 1; i < queryColumnFormulas.length; i++) { if (queryColumnFormulas[i][0] == "") { Logger.log("Inserting formula in row " + i); queryColumnFormulas[i][0] = queryColumnFormulas[i - 1][0]; // Copy formula from previous row } range.setFormulasR1C1(queryColumnFormulas); } }

function onFormSubmit(event) {
  Logger.log("Event: " + event.changeType);
  Logger.log("New row added");
  var sheet = event.range.getSheet();
  var addedRowIdx = event.range.getRow();
  Logger.log("Index of new row: " + addedRowIdx);
  var range = sheet.getRange(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, sheet.getMaxRows(), 1); // 4 == fourth column == c
  var queryColumnFormulas = range.getFormulasR1C1();
  for (var i = 1; i < queryColumnFormulas.length; i++) {
    if (queryColumnFormulas[i][0] == "") {
      Logger.log("Inserting formula in row " + i);
      queryColumnFormulas[i][0] = queryColumnFormulas[i - 1][0]; // Copy formula from previous row
    }
  range.setFormulasR1C1(queryColumnFormulas);
  }
}

ERROR MESSAGE: TypeError: Cannot read property "changeType" from undefined. (line2, file"Code")

ERROR MESSAGE:
TypeError: Cannot read property "changeType" from undefined. (line2, file"Code")

Here is a link to the googlesheetspreadsheet: https://docs.google.com/spreadsheets/d/134Jhn2accw5pa8D8K5IWZZ5w0FgXVIbJNLaEuVOsdrI/edit#gid=1014589054

Here is a link to the form: https://docs.google.com/forms/d/1uMbhcGfh9eowGZi-hJRcWanOfHxEi8nq_6NRUdfi4kU/edit

Thanks in advance to anyone who has a peak at this.

I am getting recorded weight measurements from the form. These come over and I need to subtract the weight of the container that the recorded weight from the form came from, then I need to show that weight.

I have tried adding a script to the spreadsheet. function onFormSubmit(event) { Logger.log("Event: " + event.changeType); Logger.log("New row added"); var sheet = event.range.getSheet(); var addedRowIdx = event.range.getRow(); Logger.log("Index of new row: " + addedRowIdx); var range = sheet.getRange(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, sheet.getMaxRows(), 1); // 4 == fourth column == c var queryColumnFormulas = range.getFormulasR1C1(); for (var i = 1; i < queryColumnFormulas.length; i++) { if (queryColumnFormulas[i][0] == "") { Logger.log("Inserting formula in row " + i); queryColumnFormulas[i][0] = queryColumnFormulas[i - 1][0]; // Copy formula from previous row } range.setFormulasR1C1(queryColumnFormulas); } }

ERROR MESSAGE: TypeError: Cannot read property "changeType" from undefined. (line2, file"Code")

Here is a link to the googlesheet https://docs.google.com/spreadsheets/d/134Jhn2accw5pa8D8K5IWZZ5w0FgXVIbJNLaEuVOsdrI/edit#gid=1014589054

Here is a link to the form: https://docs.google.com/forms/d/1uMbhcGfh9eowGZi-hJRcWanOfHxEi8nq_6NRUdfi4kU/edit

Thanks in advance to anyone who has a peak at this.

I am getting recorded weight measurements from the form. These come over and I need to subtract the weight of the container that the recorded weight from the form came from, then I need to show that weight.

I have tried adding a script to the spreadsheet.

function onFormSubmit(event) {
  Logger.log("Event: " + event.changeType);
  Logger.log("New row added");
  var sheet = event.range.getSheet();
  var addedRowIdx = event.range.getRow();
  Logger.log("Index of new row: " + addedRowIdx);
  var range = sheet.getRange(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, sheet.getMaxRows(), 1); // 4 == fourth column == c
  var queryColumnFormulas = range.getFormulasR1C1();
  for (var i = 1; i < queryColumnFormulas.length; i++) {
    if (queryColumnFormulas[i][0] == "") {
      Logger.log("Inserting formula in row " + i);
      queryColumnFormulas[i][0] = queryColumnFormulas[i - 1][0]; // Copy formula from previous row
    }
  range.setFormulasR1C1(queryColumnFormulas);
  }
}

ERROR MESSAGE:
TypeError: Cannot read property "changeType" from undefined. (line2, file"Code")

Here is a link to the spreadsheet: https://docs.google.com/spreadsheets/d/134Jhn2accw5pa8D8K5IWZZ5w0FgXVIbJNLaEuVOsdrI/edit#gid=1014589054

Here is a link to the form: https://docs.google.com/forms/d/1uMbhcGfh9eowGZi-hJRcWanOfHxEi8nq_6NRUdfi4kU/edit

Source Link
Jeff
  • 21
  • 2

How can I get my set values and formulas to populate to a row of values received from a Google Form?

When I receive submissions from a form I am trying to find a way to include my formulas and set values in the same row as the information submitted by form.

My form is only collecting 14 values but my data sheet for the form responses is 45 columns wide.

I am getting recorded weight measurements from the form. These come over and I need to subtract the weight of the container that the recorded weight from the form came from, then I need to show that weight.

I have tried adding a script to the spreadsheet. function onFormSubmit(event) { Logger.log("Event: " + event.changeType); Logger.log("New row added"); var sheet = event.range.getSheet(); var addedRowIdx = event.range.getRow(); Logger.log("Index of new row: " + addedRowIdx); var range = sheet.getRange(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, sheet.getMaxRows(), 1); // 4 == fourth column == c var queryColumnFormulas = range.getFormulasR1C1(); for (var i = 1; i < queryColumnFormulas.length; i++) { if (queryColumnFormulas[i][0] == "") { Logger.log("Inserting formula in row " + i); queryColumnFormulas[i][0] = queryColumnFormulas[i - 1][0]; // Copy formula from previous row } range.setFormulasR1C1(queryColumnFormulas); } }

I found this in a previous answer and added my column numbers where values or formulas are stored but I am getting an error.

ERROR MESSAGE: TypeError: Cannot read property "changeType" from undefined. (line2, file"Code")

Here is a link to the googlesheet https://docs.google.com/spreadsheets/d/134Jhn2accw5pa8D8K5IWZZ5w0FgXVIbJNLaEuVOsdrI/edit#gid=1014589054

Here is a link to the form: https://docs.google.com/forms/d/1uMbhcGfh9eowGZi-hJRcWanOfHxEi8nq_6NRUdfi4kU/edit

Thanks in advance to anyone who has a peak at this.