Data read modify Googlesheet Sheet3


What is the problem with my code? :cry:

That script will only really work for the example data and app shown in the video.

Also, as previously advised, you probably need to clean your data on your sheet of all emoji and images

I now have a new script, that will work on most spreadsheets, and example app, but I need to write this up.

Now written up:

1 Like

I have moved all your subsequent posts here

Lot if thanks your help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :blush: :blush: :blush: :blush: :blush: :blush: :blush: :blush: :blush: :blush:

i try it and i have message :cry: :cry: when i click read all button:

I paste my sheet ID and sheetname is it okay? Or i not work good? :frowning: Thanks your help!!!!!

  1. You did not need to edit the google apps script (This was the whole point of the exercise)
  2. You set the sheetId (the id of the spreadsheet) and the sheetname (the specific sheet in the spreadsheet) in the variables in the app
1 Like

Ohhhh :scream:. Okaaay i tryyyy

Processing: Screenshot_2022-09-18-19-57-22-433.jpeg...

I not Edit tud script i get this message when I click readall btn

you have added wrong values in base url and sheet id ..

Pls read the @TIMAI2 guide properly.. There is no way to mis use the blocks. Everything were oerfectly placed.

I am surprised, How do you misread this blocks

2 Likes

Thank You.

Sorry I think I put link okaaay i try without😊

1 Like

I try but cant work :frowning:


You have some problem with your script url code. Compare your script url with Timai2 script url.

Your url doesnot contain macros.. So your code returns html page with error

Run the base url in browser and capture the result and oaste here. Maybe Tim will help you further.

Also why do you edit this code? You should not.

Here SHEET ID and SHRET NAME text only should come.

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");
}

}

Have you deploy it properly? Using anyone option?

Read here

1 Like


Yes its anyone

Yeah, now your script url is correct.. Copy that url and paste into the blocks and try..

Meanswhile furst run the base url in any web browser and see the result

1 Like

Not work :frowning: