Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9788

Any idea why I am getting duplicated cells in google sheets?

$
0
0

Hi there can anyone tell me why am getting a duplicate on the following code in cell c3

I am getting this anytime a new form was added

function onEdit(e) {  // Get information about the edited cell  var sheet = e.source.getActiveSheet();  var sheetName = sheet.getName();  var cell = e.range;  var cellAddress = cell.getA1Notation();  var cellValue = cell.getValue();// You can add any logic you'd like here. For example:// Check if the edited cell is in a specific range   // Show a dialog box  var ui = SpreadsheetApp.getUi();  var lastRow = sheet.getLastRow();//ui.alert("Cell " + cellAddress +" has been modified!");  //ui.alert("Lastrow: " + lastRow)  //Get event values  var thecolumn = e.range.getColumn();  var therow = e.range.getRowIndex();  var thevalue = e.range.getValue();// Hideing after resolved and duplicate  if ((thecolumn == 10) && (sheetName == "Response") && ((thevalue == "Resolved" ) || (thevalue == "Duplicate" ))) {    // Code to remove line, else do nothing     //ui.alert("Value is:" + thevalue);     sheet.hideRows(therow);  }}function onFormSubmit(e) {  // Get the form response  var formResponse = e.response;   var sheet = e.source.getActiveSheet();  var lastRow = sheet.getLastRow();  var sortRange = sheet.getRange("A3:L" + lastRow);  var sortColumn = 1; // Adjust the column number to sort by   sortRange.sort({ column: sortColumn, ascending: false });   //center the column data  var range = sheet.getRange("D3:J3"); // Adjust the range as needed  range.setHorizontalAlignment("center");}

Viewing all articles
Browse latest Browse all 9788
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>