This is not what you are doing
You are sending all queries at the same time
If you really want to first get some data and after getting that data, then delete something, you should send the delete query in the Web GotText event of the first query
i got all data unsing the query and sent it to another google sheet, all i want now is to fix the delete where query equation so after getting the data by select where equation and sending it using the above block as it helped me to send all where data with no need to select the listview selection if you remember, so all i want no is to delete where eqution as that one doesnt work
delete where D='' and E='' and K='' and G='' and I=''
in the first screen shot,
i got all data by where equation sending to the web name استيراد خارجي 2
then in the web after getting all components to the second listview, i send these data to the driver sheet in the second screen shot,
as you remember
mustafa egypt usa num 1
taifun egypt usa num 2
so after getting
egypt usa sum num 3 using the second screen shot method, there is no need to
send each row manually, just sending all by clicking on the listview 1 selection where is select where equation
i used that method instead of trying to select all elements in the listview 2 and it worked well,
so i wanna delete where equation same as i send in the screenshot 2
@Taifun lets adjust that script equation to try that method
else if (e.parameter.func == "Deletewhere") {
var ss = SpreadsheetApp.getActive();
var sh = ss.getSheets()[0];
var dataRange = sh.getDataRange();
var values = dataRange.getValues();
for (var i = values.length - 1; i >= 0; i--) {
if (
values[i][3] != "" && // Column D
values[i][4] != "" && // Column E
values[i][10] != "" && // Column K
values[i][6] != "" && // Column G
values[i][8] != "" // Column I
) {
sh.deleteRow(i + 1);
}
}
return ContentService.createTextOutput("Success");
}
this is the delete equation i used , its deleting but not the exact values which needs where existed values selected in the listview
//DELETE SINGLE RECORD
else if (e.parameter.func == "Delete") {
var record = e.parameter.id;
var ss = SpreadsheetApp.getActive();
var sh = ss.getSheets()[0];
sh.deleteRow(parseInt(record) + 1);
return ContentService.createTextOutput("Success");
unfortunately you make it very difficult to help...
and you do not follow the suggestions, which results in a waste of not only your time, but also of those who like to help
as said already twice, now the third time: you are sending all queries at the same time to the database... so if you select some data and delete that data at the same time unexpected things will happen...
why do you want to use an apps script to delete now? why are you mixing different concepts? why not using gviz as earlier?
first select the data, then in the Web.GotText event receive the data and do something else, for example to delete the data
you also failed to provide a Do it result of the delete query and of the raw response content after trying to delete
am not sending multiple queries at the same time, the sum arranging query in the screen inilalize, while that delete query is a button click, plus i dont understand the concept of do it, here is the do it result for the label but not showing anything in the label, Am a beginner in that site so most of things i do know is learning it by searching and trying!
i replaced it with select query as delete query which i am currently needing
lets be calm with me our teacher lol, we cant be perfect in our first step, i just wanted to make something out of box and it worked with me, it was so hard to select all elements from listview detail in the same time so what i make above made me sending all detail data with only clicking on the listview main, so after sending these data to another sheet,i wanted to make another query which is a delete where D, E query equation
opps lol, i was right then when i used that delete script function then but to make what i want implemented, i guess i will use the select gviz query one more time again to select the listview 2 elements and then ask for deleting from listview2, i dunno if it will work but will try anyway
what i did
the first query is to select where b,c...so on, in the list view 1 data arranging
when the listview2 detail after picking i made it send all these data immediately to the list view driver so after sending the list view 3 driver, the same where details data should be deleted from the main google sheet,
so arranging from listview1
detail and send to 3 from 2
delete from google sheet to send to another google sheet driver
so that where b,c delete what am looking for