Adding rows to google sheet with google script

I am trying to repeat TIMAI2 simple example ilustrating adding rows to google sheet but without success. Link to my spreadsheet is:


anybody who has this link can even edit this spreadsheet !
Link to script is the following:

https://script.google.com/macros/s/AKfycbxMy5E1EP4lBOlXaqXhMGq8oq8QKIvdRNNnZ6fmE9J7cwLSy5E/exec
Following TIMA2 instructions my block in application is :


Nothing happens when I press DODAJ button. Please help !!!!

Link

Please also show your script in text here - your link is of no use if using posttext.

1 Like
function doGet(e)
{ 
  var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1C0uOsx_LdKYEu3oR18C_teNCo1gvJLPIiuj5YIbDN18/edit#gid=0");
  var sheet = ss.getSheetByName("Sheet1"); 
  return addUser(e,sheet);  
}

function doPost(e) 
{ 
  var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1C0uOsx_LdKYEu3oR18C_teNCo1gvJLPIiuj5YIbDN18/edit#gid=0");
  var sheet = ss.getSheetByName("Sheet1"); 
  return addUser(e,sheet);  
}

function addUser(e,sheet)
{
  var id = e.parameter.id ; 
  var name = e.parameter.name ;
  sheet.appendRow([id,name]);
}

This is exactly your script eth the id's of my google sheet. What I am doing wrong ?

Have you deployed the script correctly, with the script url matching the one in the app ?

It seems you haven't given the correct permissions...

https://script.google.com/macros/s/AKfycbxMy5E1EP4lBOlXaqXhMGq8oq8QKIvdRNNnZ6fmE9J7cwLSy5E

You have still not deployed your apps script correctly and given / authorised permissions

it works, Thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.