Help with this google sheet

can anyone helpwith edit this code

function doGet(e) {
  var message = "";
  var ss = SpreadsheetApp.openById(e.parameter.sheetId);
  var sh = ss.getSheetByName(e.parameter.gridName);
  var rg = sh.getName() + "!" + sh.getDataRange().getA1Notation();
  var sql = e.parameter.query;
  var qry = '=query(' + rg + ',\"' + sql + '\",0)';
  var ts = ss.insertSheet();
  var setQuery = ts.getRange(1,1).setFormula(qry);
  var getResult = ts.getDataRange().getValues();
  if (getResult[0][0] == "#N/A") {
  message = 'username not present';
  } else {
  if (getResult[0][1] != e.parameter.pwd) {
  message = 'incorrect password';
  } else {
  message = 'signed in'+getResult[0][2];
  return ContentService.createTextOutput(message);

so if first button click then send the value of get result{0{{2) but if secodn button presss then it decuts the value in textbox of app in google sheet username

You do not show your relevant blocks or data on your spreadsheet. We need these two along with your script to be able to begin to help.

No actually ididnt make any blocks for this I was not understanding what block to put

You wrote about pressing buttons ???

That was logic I want to make

So can you please send me the code

See here:

But it doesn't deduct from row c the value in textbox

As said previously, without being able to see your relevant blocks and the data on the spreadsheet, it is difficult to provide further help.

Ok thnx

now as you see that i have made a code so when button 2 click then it decreses the value in textbox and then appends it in google sheet

  1. You have not set the web app script url, without it your blocks will do nothing
  2. No password ? If so why script for a password ?
  3. You are querying (reading) data, your script will not replace (update) any data

If you want a full CRUD script (create,read update and delete), then see here:

or use the native Spreadsheet component

I know that

Give code

What about trying the tutorial mentioned earlier?

1 Like