function doGet(e) { if ( fn == 'DELETE' ) { var ss = SpreadsheetApp.openById('1QBVGQnc8sbvsDnjg7C7VGfvGhIckvT6pNDPmUQH9R5w'); var sh1 = ss.getSheetByName('Result'); var rg = sh1.getDataRange().getValues(); var student_name = e.parameters.student_name; // current value of student_name for (var i = 0; i < rg.length; i++ ) { if ( student_name == rg[i][0] ) { sh1.deleteRow(rg[i]+1); } } return ContentService.createTextOutput("Record deleted"); } } function doPost(e) { if ( fn == 'INSERT' ) { var student_name = e.parameters.student_name[0]; var score_01 = e.parameters.score_01[0]; var score_02 = e.parameters.score_02[0]; var score_03 = e.parameters.score_03[0]; var score_04 = e.parameters.score_04[0]; var score_05 = e.parameters.score_05[0]; var score_06 = e.parameters.score_06[0]; var score_percent = e.parameters.score_percent[0]; var ss = SpreadsheetApp.openById('1QBVGQnc8sbvsDnjg7C7VGfvGhIckvT6pNDPmUQH9R5w'); var sh1 = ss.getSheetByName('Result'); sh1.appendRow([student_name,score_01,score_02,score_03,score_04,score_05,score_06,score_percent]); return message("Success: The Result Was Saved"); } } function message(msg) { return ContentService.createTextOutput(msg); }