I am using a form in Google docs. I have script that form for a column auto increasing for every entry and another function to check whether the current entry have a similar entry or not. codes are given below.
function onFormSubmit(e) {
var sheet = SpreadsheetApp.getActiveSheet();
var row = SpreadsheetApp.getActiveSheet().getLastRow();
sheet.getRange(row,7).setValue('sn'+(row-1));
}
function removeDuplicates() {
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getDataRange().getValues();
var newData = new Array();
for(i in data){
var row = data[i];
var duplicate = false;
for(j in newData){
if(row[1] == newData[j][1] && row[2] == newData[j][2]){
duplicate = true;
}
}
if(!duplicate){
newData.push(row);
formSubmitReply();
}
}
sheet.clearContents();
sheet.getRange(1, 1, newData.length, newData[0].length).setValues(newData);
}
as you you can see the 1st function is for auto increasing a column and the 2nd one for checking the duplicate entry. I can trigger them differently but what I want to do is that, to call the 1st function in the 2nd function as well, so that while i trigger the 2nd function submitting the form, that automatically run the 1st function in it. How can I do that??
Note: Simple call like onFormSubmit() didn't work.