Unable to delete or load data with Sheets

Hi! I am trying to create a screen to see all data (teams created) and I followed this tutorial.

I did it but when I attempt to delete certain data (teams) or load all data (all teams in Sheets) it does nothing. This is my code in the Google Sheets that stores the data:

function doGet(e){
return ManageSheet(e);
}
function doPost(e){
return ManageSheet(e);
}



function ManageSheet(e){

//Read All Recors
  if ( e.parameter.func == "ReadAll") {
    var ss = SpreadsheetApp.getActive();
    var sh = ss.getSheets()[0];
    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);
  }


}

and these are the code blocks I used:


^ this block is to delete, the tutorial used a button but I used the notifier choice.

I already have working code made to create the teams and load the data (teams) into the Sheet. Please help!

The .aia:
HomeBase_copy (2).aia (256.3 KB)
^ the screen I am having trouble with is "COACHcalendar"

Sorry! The last block I put that deletes the sheet is actually this one:

When I use these code blocks to load certain data from sheet


And this shows on list:


(not data)

When you see html, it's usually an error message.

Check the permissions on your sheet.

Here's your error message in all its glory:

Do It Result: "<!DOCTYPE html><html><head><link rel="shortcut icon" href="//ssl.gstatic.com/docs/script/images/favicon.ico"><title>Error</title><style type="text/css" nonce="nqZLAGDKOgprcZ4jtdjeMQ">body {background-color: #fff; margin: 0; padding: 0;}.errorMessage {font-family: Arial,sans-serif; font-size: 12pt; font-weight: bold; line-height: 150%; padding-top: 25px;}</style></head><body style="margin:20px"><div><img alt="Google Apps Script" src="//ssl.gstatic.com/docs/script/images/logo.png"></div><div style="text-align:center;font-family:monospace;margin:50px auto 0;max-width:600px">ReferenceError: outstring is not defined (line 21, file &quot;Code&quot;)</div></body></html>"
---

(Scroll all the way to the right)
Here's how I captured it using an extra global variable responseContent and the Companion's Do It feature:

So now the question is, what is this outstring variable in line 21 of your script?

To diagnose your spreadsheets blocks, I would need to see how you set up the spreadsheet component.

For a small app like yours, it is simpler to load the whole sheet and use list blocks to get to the data you want.

P.S. I can't support scripting.

Thank you! I fixed the column data by storing data in one column ex: (Coach+team) and it works great! But if I wanted to delete certain data from sheet if clicked in listviewer, how?

Also, I deleted the extra coding to simplify it and it works.

As per the code you can delete it by row number,

Take the web2 url and run it in the browser so you will come to know what is the reason actually.

If you do not make any changes in the function delete, then no worry

I deleted web2 and now the "delete?" notification and action looks like this:

I'm trying to use this block to filter to find the exact row, but I don't know how to find the colID

pls show your script code so as to assist you better.

I always recommend these script codes only.

@TIMAI2 credit

Hi, I only have the basic script code given when a new spreadsheet is created. I just do not know how to get a colID

This is my spreadsheet (dummy data)


and I am trying to find colID for column B (data)

Col B means then its ColID is 2,

the value should match col B

Guide

Ok thank you! So to delete the row with value searched, would it be this?

Before you delete make sure you are getting the exact row.

But the above blocks are correct, sounds good

(Note:You can achieve this using single web get request with the help of script url and no need of api)

I don't understand what you mean by exact row, also when I try to emulate the app on my phone everything works until I delete a team (It exits out of app)

First web get request to get exact row number

Second web get request to delete the obtained row number

And this apps scripts deletes exact row based on the matching data with col B by sending single web get request

Like this?


I tried it and it still exits me out of the app on my phone when I press delete.

(also my MIT App Inventor shows 1 warning and 1 error but I can't find them in the code)