Simple update google sheet data

How to update google sheet data to simple proses without Google Sheet CRUDQ II

CRUDQll is good but very bigger process.
I have need simple process. Its possible?
If its possible then please give me Sheet script and block.

Here is my collection.
Judge for yourself which is easiest ...

Also see this tutorial ...

1 Like

only data delete is work but Update Record &Create new record are not work.
show this massage

There will be an error message at the bottom of that html text

Does ReadAll work for you ?

@TIMAI2
Yes, Readall is working..... & list view also work But only Update data and create new data not working. When click updateRecord & Create Record showing This error Massage.
what can I do now?

What is the error message?


This one.
when I click updateRecord or Create new button showing this massage. but Google sheet data not updated or not create new records. but When I click delete button This button are working, deleted data from Google sheet, What is the problem for updating?

Please copy the entire error message (html) and post it here. If you can do this for both Create and Update it would save time.

@TIMAI2

Error 400 (Bad Request)!!1 *{margin:0;padding:0}html,code{font:15px/ 22px arial,sans-serif} html{background:#fff;color:#222;padding: 15px}body{margin:7% auto 0; max-width: 390px;min-height:180px;padding:30px 0 15px}*>body{background:url(// www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px} p{margin:11px 0 22px;overflow:hidden} ins{color:#777,text-decoration:none}a img{border:0}@media screen and (max-width: 772px)(body{background:none;margin-top: 0,max-width:none;padding-right:0}} #logo{background:url(//www.google.com/ images/branding/googlelogo/1x/

googlelogo_color_150x54dp.png) no- repeat;margin-left:-5px}@media only scree and (min-resolution:192dpi) {#logo{background:url(//www.google.com images/branding/googlelogo/2x/ googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100% ;-moz-border-image:url(// www.google.com/images/branding/ googlelogo/2x/ googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel- ratio:2){#logo{background:url(// www.google.com/images/branding/ googlelogo/2x/ googlelogo_color_150x54dp.png) no-repeat;- webkit-background-size:100% 100%}} #logo{display:inline-block;height:54px;width: 150px}

400. That's an error.

Your client has issued a malformed or illegal request. That's all we know.</ ins> Ser

OK, it is currently a problem in the app / blocks, for the URL being sent.

Check the values you use for script, Id, sheet, and look at what the URL is like for create or update. You can share these back here.

@TIMAI2



Did you try this first with my sample data ?

Did that work for create and update ?

@TIMAI2
My dear,
I am Uploaded your aia file and change only 2 factor

  1. Sheet Script and Sheet ID
  2. Text box Name & Quantity

facing any problem?

@Spicy_Topics
I humbly request to you Please see my Above massage.
I am facings 2 problem.

  1. Update Record Not working
  2. Create New Record Not Working

when I click updateRecord or Create new button showing this massage. but Google sheet data not updated or not create new records. but When I click delete button This button are working, deleted data from Google sheet, & ReadAll Record Are working Properly.
What is the problem only for updating data?

I have tested my original project, the one I used to make the video. This still works fine, I can create and update records. There is nothing wrong with the script or the blocks with the spreadsheet data layout I have shown

You also changed the SHEETNAME (as seen in your blocks), and your spreadsheet is quite different.

You should start again, run a test using the data I supplied, if only to prove to yourself that everything works. Make a backup of your working project for reference.

Then change one thing at a time, testing as you go, until you find what it is you have changed that breaks things. My guess is your spreadsheet layout. Reorganise the columns so that they are in a similar order to my example data.

If any extra single text or comma or semi col added in the above scripts then it will report the bive error.

If possible share your script code..

Because unnoticed single hyphen will cost much

@Spicy_Topics

function doGet(e) {

var ss = SpreadsheetApp.openById(e.parameter.SHEETID);
var sh = ss.getSheetByName(e.parameter.SHEETNAME);
var rg = sh.getDataRange().getValues();


  //READ ALL RECORDS
  if ( e.parameter.FN == "ReadAll" ) {
    return ContentService.createTextOutput(JSON.stringify(rg)).setMimeType(ContentService.MimeType.JSON);
  }

  //READ SINGLE RECORD
   else if ( e.parameter.FN == "ReadRecord" ) {
    var ref = sh.getRange(parseInt(e.parameter.ROWID)+1,1,1,rg[0].length).getValues();
    return ContentService.createTextOutput(JSON.stringify(ref)).setMimeType(ContentService.MimeType.JSON);
  }
  
  //DELETE SINGLE RECORD
   else if ( e.parameter.FN == "Delete" ) {
    sh.deleteRow(parseInt(e.parameter.ROWID) + 1);  
    return ContentService.createTextOutput("Record Deleted");  
 } 

  //UPDATE SINGLE RECORD
   else if ( e.parameter.FN == "Update" ) { 
    var data = JSON.parse('[' + e.parameter.DATA + ']');
    sh.getRange(parseInt(e.parameter.ROWID) + 1,1,1,data[0].length).setValues(data);
    return ContentService.createTextOutput("Record Updated");
  }

  //CREATE NEW RECORD  
  else if ( e.parameter.FN == "Create" ) { 
    var data = JSON.parse(e.parameter.DATA);
    sh.appendRow(data);
    return ContentService.createTextOutput("New Record Appended");
  }

}

This is my Sheet Script. I am only Copy this Script from @TIMAI2 Simple CRUD with Google Sheets and Apps Script (fixes Hay Kel flaws...)
post And paste in my sheet.

Dear Sir, I Start again, I am just upload your aia file, Copy Script and pest my new Sheet, Change Script link, Sheet ID & Sheet Name Like as your sheet. But I facing Same Problem. ReadAll DataAnd Read Record only working But Update & Create new Data Not working show same error massage.