Read all and delete data in google sheet using script

Try setting the variables ss and sh either outside the doGet(e) function, at the top of the script, or at the very least before you call the ManageSheet(e) return. If you use the doPost(e) function, then you need to ensure that these variables are set.

Do not forget to re-deploy your script to a new version

Thanks for the answer, but ist not still working, do I need to have an activator in app scrip, to start with the process ?

another question

to be able to modify the spreadsheet do I need to use a code like this?

image

because when I runn this code, In the app appears a message saying that the app is not able to read the code because of the format csv.

the way to runn the function was introducing the this URL

https://docs.google.com/spreadsheets/d/1CrkHxMFe2XtsKLhjHkQsK2279HED1M-79ys4yIEIj6I/export?format=csv

image

My doubt is if beacause the URL link with the end export?format=csv

it is not posible to modify the spreadsheet ?

thanks for your attention

Not sure what you mean by this? You appear to have your script deployed correctly because you have a script url. Have you allowed the script to run as "Anyone" ?

No, because you have hardcoded the spreadsheet ID and the sheetName in the script

If you use this url:

You do not need to use the script (if your spreadsheet has access for anyone permissions). This will return the data in csv format, which you can convert to an AI2 list in the Web1.GotText.

This looks wrong

image

Because you are using doGet(e) to get data, you should be able to test your urls in your computer browser, which will either display results or download a csv file to your computer

TIMA12 , Thanks for your answer,

The activator like this in app script

image

let me show you the screen where I allowed Anyone to have acces.

when I use in my computer it donwload this

image

but it is not letting me delead the row en the spreadsheet when I press the bottom liberar.

You do not need any triggers. By sending a GET or POST from the app, the web app will run.

Test your two GET urls in your browser, or share your aia project here for my attention.

I send you my aia proyect

I hope you can help please

:bowing_man:

I will take a look soon...

You have errors in your web app script (aside from the errors in your blocks), I will need to do more work on it later.

I also note your data upload blocks using a google form, does this work ???

sorry at the beggining it works, but now, that I need to do more things like modify the spreadsheet and delete a row it is not working :frowning:

If you can help me please how it need to be donne I will be really thanksfull for ever with you

what I need is to make registers in an spreadhsheet and then do be able to modify those registers my app inventor

:bowing_man:

I am going to suggest that you try out my GSConnected extension

This will handle data uploads to the sheet, and data downloads, along with updates and deletions

Follow the instructions carefully and you should have a fully working Create/Read/Update/Delete setup for your app.

This will be much better than trying to work with a poorly put together script method by "others...."

1 Like

Thanks Deare TIMAI2,

You are really awesome, I use your codes:

and those work good, I will studie them to understand them in order to be able to make my own codes, really thanks.

have a nice day.

TIMA

I have been working on the same code but I can't achieve the result that I'm looking for.

when I want to see the info in a Listview from a spreadsheet It shows me this message

Do you know that can I do, because with this selection I need to do an Update. from anther list pick.
I will show the app screen

And the app Inventor blocks

I wish you can show me the solution

use the above for sheet, script and blocks

Ran a quick test on your data, and it works OK, although it looks like there is some work to do on date formats. Obviously requires your layout/textboxes etc. to fit the data.

wow,

how do you do it ?

it is wire I use the tips that I found in the youtube Chanel for the sript but it is not working yet

function doGet(e) {

var ss = SpreadsheetApp.openById(e.parameter.ID);
var sh = ss.getSheetByName(e.parameter.SH);
var Funcion = e.parameter.FUNCION;
var rg = sh.getDataRange().getValues();
var outString = '';

if ( Funcion == 'ENVIAR' ) {
var registro = e.parameter.REGISTRO.split(',');
sh.appendRow(registro);
return ContentService.createTextOutput("New record created");
}

else if (Funcion == 'READ') {
for (var row= 0;row<rg.length; ++row){
outString += rg [row] .join (',') + '\ n';

}
return ContentService.creatTextOutput(outString).setMimeType(ContentService.MimeType.TEXT);
}
}

Even I try to do it in another way like another tutorial

with the code

else if ( Funcion == 'READ' ) {
return ContentService.createTextOutput(JSON.stringify(rg));

}

but it is not working either

If you continue to try other methods that do not work, you will not get anywhere.

Use the example I have provided above and follow the guide.

Ok ,

I Just rey to use the blokcs that you show me as far I as undertand

Let me show you the Bloks

But Is not still working

I see a little bit deeper in the guide that you show me, here Is very late but tomorrow al the very bigging I will follow the guide

Thants for the attention

image