Row on google sheet doesn't deleted

i make invoice system while i collect payed invoice it deleted from pending sheet and set in completed sheet on google sheet workbook but it doesn’t set data of special row and doesn’t delete special row by knowing row number.

what shall i do? to solve this problem?


What script you are using

function doGet(e) {

return ManageSheet(e);

}

function doPost(e) {

return ManageSheet(e);

}

function ManageSheet(e) {

//READ ALL RECORDS

if ( e.parameter.func == “ReadAll”) {

var ss = SpreadsheetApp.getActive();

var sh = ss.getSheets()[parseInt(e.parameter.SN)-1]; 

var rg = sh.getDataRange().getValues(); 

var outString = '';

  for(var row=0 ; row<rg.length ; ++row){

    outString += rg[row].join(',') + '\n';  

  } 

return ContentService.createTextOutput(outString).setMimeType(ContentService.MimeType.TEXT);

}

//DELETE SNNGLE RECORD

else if (e.parameter.func == “Delete”) {

var record = e.parameter.id;

var ss = SpreadsheetApp.getActive();

var sh = ss.getSheets()[parseInt(e.parameter.SN)-1];

sh.deleteRow(parseInt(record) + 1);  

return ContentService.createTextOutput("true");  

}

//READ SNNGLE RECORD

else if ( e.parameter.func == “ReadRecord”) {

var ss = SpreadsheetApp.getActive();

var sh = ss.getSheets()[parseInt(e.parameter.SN)-1];

var rg = sh.getDataRange().getValues();

var outString = '';

outString += rg[parseInt(e.parameter.id)].join('**');

return ContentService.createTextOutput(outString).setMimeType(ContentService.MimeType.TEXT);

}

//UPDATE SNNGLE RECORD Specify PoSNtion

else if (e.parameter.func == “UpdateSP”) {

var ss = SpreadsheetApp.getActive();

var sh = ss.getSheets()[parseInt(e.parameter.SN)-1];

var data = [ [ e.parameter.UpdateRecord ] ]; 

 sh.getRange((e.parameter.CN)+(parseInt(e.parameter.id)+1)).setValues(data); 

return ContentService.createTextOutput("true");

}

//Do not changed any parameters, because this is new script. for more information please watch this video:- How to use Google Spreadsheet extension V3 in kodular part 2 - YouTube

//CREATE NEW RECORD

if (e.parameter.func == “Create”) {

var ss = SpreadsheetApp.getActive();



var sh = ss.getSheets()[parseInt(e.parameter.SN)-1];



var data =[e.parameter.A, e.parameter.B, e.parameter.C, e.parameter.D, e.parameter.E, e.parameter.F, e.parameter.G, e.parameter.H, e.parameter.I, e.parameter.J, e.parameter.K, e.parameter.L, e.parameter.M, e.parameter.N, e.parameter.O, e.parameter.P,e.parameter.Q, e.parameter.R, e.parameter.S, e.parameter.T, e.parameter.U, e.parameter.V, e.parameter.W, e.parameter.X, e.parameter.Y, e.parameter.Z]; 



sh.appendRow(data);



return ContentService.createTextOutput(data);

}

}

but problem when choose item in th middle of column to make action on it, it works with the upper values on the top of column and lower value on the end of column but not on the middle

I always prefer the code given in this link, and still working good.

Credit to @TimAi2

doesn’t work my extetension

No need of extension… just use the above script and do the magical thing in web got text

Or better try this