Post to google sheet error

Hello guys, im sorry i want to ask again with the same topic in the past,

I tried to post a text to google sheet with app script, but it doesnt work, can you help me again guys ? Thanks

You have a problem with your script configuration.

Check you have published the latest version, and that it is available to "Anyone"

Also see here:

1 Like

As I said, it needs to be "Anyone", NOT "Anyone with a google account". You also need to set the Web app to execute as "you" - your google account.

2 Likes

ahh i see i see. i remember and success. thanks sir

@TIMAI2 , btw sir can i ask more question..

i have a column student name and score , if i want to delete row based on the student name, how can i get the id ?

You need to send the student name value to the google apps script web app, then iterate over all the records to find a match, then delete the row that matches. You would need to update any local app list of the same data accordingly. I will put together a script for you if you need this?

1 Like

May i ? If you dont mind, can share the script ? Im still confused

Try this:

// deletes a single record (and its row) from sheet, 
//based on student_name in first column
  else if ( fn == 'DELETE' ) {
    
    var rg = sh.getDataRange().getValues();

    var sn = e.parameter.student_name;  // current value of student_name
    for (var i = 0; i < rg.length; i++ ) {
      if ( sn == rg[i][0] ) {
        sh.deleteRow(rg[i]+1);
      } 
    }
    return ContentService.createTextOutput("Record deleted");    
   }

can you give me example for the block too sir ? thanks before

You need to send:

script url
?fn="DELETE"
&sn="student_name value"

You should add these to your url and use Web3.Get

1 Like

Ok will try it

Here it is the error
ERROR APPSCRIPT.txt (1.3 KB)

the block

??? You are using PostText ???

That is better...but remove the quotes around DELETE.

image

still error sir

This error?

Not seen that one before...

yes its still error sir