Hello, I'm building an APP to read data and single records from Google Sheets; besides, I need to be able to update records from App Inventor to Google Sheets.
The Google Apps Script created, together with the App, works perfectly to show the data and the single records; unfortunately, I am not able to update the records, and I don't understand why.
Please some help would be very much appreciated, thanks.
PS: here after I share the .aia file, the blocks used in the page where the update is run, and link to the Apps Script used: ConsegnaRitiroMezzi_StessoFoglio_GoogleAppsScript - Google Docs
FL01_Manteinance_04.aia (99.9 KB)
TIMAI2
May 19, 2024, 10:01pm
2
What do you get back in responseContent for Web3.gotText ?
Hi, in my blocks I don't see a Web3.gotText
I just see a "set Web3.Url to" and a "call Web3.Get".
Then add it, and put the response content to a label.
Hi, I did it (here after the blocks).
I put the content in text boxes.
Now in the APP, it shows the update, but that doesn't go to the google sheet database, so if I recall the record, it's not updated.
Not quite....
Like so:
and your button click event as before:
What do you get returned?
Ok, here is what I get in return:
" Exception: The parameters (String) don't match the method signature for SpreadsheetApp.Sheet.setActiveRange."
Try removing one set of square brackets from your data line:
From:
var data = [ [ e.parameter.ritirato, e.parameter.giornoritiro, e.parameter.oraritiro, e.parameter.cognomeritiro, e.parameter.nomeritiro ] ];
To:
var data = [ e.parameter.ritirato, e.parameter.giornoritiro, e.parameter.oraritiro, e.parameter.cognomeritiro, e.parameter.nomeritiro ] ;
Remember to deploy your script to a new version
Did that, deployed again and saved the new link in the APP, but it gives me back the same error...
TIMAI2
May 20, 2024, 10:41am
10
Show the full output of the Web1.url
TIMAI2
May 20, 2024, 11:12am
11
Possible issue:
should be ?func=Update
(change this and revert your script to the two square brackets)
TIMAI2
May 20, 2024, 11:22am
12
Found the problem
line 53 in your script
Change:
sh.getDataRange
To:
sh.getRange
so that it looks like this:
var data = [ [ e.parameter.ritirato, e.parameter.giornoritiro, e.parameter.oraritiro, e.parameter.cognomeritiro, e.parameter.nomeritiro ] ];
sh.getRange("M"+(parseInt(e.parameter.id)+1)+":Q"+(parseInt(e.parameter.id)+1)).setValues(data);
Wow, Amazing!!
It works perfectly, thanks a lot!!
Lancio83:
It works perfectly,
if your problem is fix then update it script (in google docs) also and share your right block, it help others also.
TIMAI2
May 20, 2024, 6:45pm
15
Well, I actually showed the correct code lines in my answer...
2 Likes
system
Closed
May 27, 2024, 6:45pm
16
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.