samcho
March 23, 2025, 6:04pm
1
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"
samcho
March 23, 2025, 6:05pm
2
Sorry! The last block I put that deletes the sheet is actually this one:
samcho
March 23, 2025, 7:02pm
4
When I use these code blocks to load certain data from sheet
And this shows on list:
(not data)
ABG
March 23, 2025, 7:07pm
5
When you see html, it's usually an error message.
Check the permissions on your sheet.
ABG
March 23, 2025, 7:21pm
6
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 "Code")</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?
ABG
March 23, 2025, 7:25pm
7
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.
samcho
March 23, 2025, 7:33pm
8
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?
samcho
March 23, 2025, 7:33pm
9
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
samcho
March 23, 2025, 7:39pm
11
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
samcho
March 23, 2025, 7:43pm
13
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
samcho
March 23, 2025, 7:45pm
14
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
samcho
March 23, 2025, 7:55pm
16
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)
samcho
March 23, 2025, 7:58pm
18
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
I understand your problem now more clearly after seeing your blocks slowly one by one.
Enable the ShowlistAsjson from teh project propertise
Since we are sending col B to col K data only to gsheet to find the matching data to be deleted, i am modifying the script code to look in from Col B to col K then delete it. Here is the revised code. Now paste these code , deploy it, take teh script url, change the project settings, paste teh url and try to delete.
function deleteRow(dataArray, sheet) {…
samcho
March 23, 2025, 8:05pm
20
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)