Hi,
I have developed an app which at one point I want to send anonymous text data to a Google Sheet I create for storing its output. So I have been playing with creating a Google sheet and adding script to it to process posts to it. I am making use of tried and tested code kindly provided by AI2.Metricrat. Here is the script:
//This script is bound to the spreadsheet. It therefore uses getActive() to get the
//spreadsheet it is bound to, and getSheets()[0] to get the first sheet in the spreadsheet
var ss = SpreadsheetApp.getActive();
var sh = ss.getSheets()[0];
//POST function appends all data sent as parameters to the next row on the sheet, in the order sent
function doPost(e) {
var data = JSON.parse(e.postData.contents);
sh.appendRow(data);
return ContentService.createTextOutput(data);
}
I have deployed the sheet script and made it available to 'Anyone' and used its deployed URL in a small Appinventor app to test it. I wrote a short app to test posting to its URL using the Web component during screen initialisation. It works OK and consistently with the test app. See the attached image from the google sheet used as a test-bed.
So I have then added blocks to some of my other apps and with two of them all seemed well, see the google sheet image. However I soon found other apps, including versions of my main app, which is much larger, where no message was consistently NEVER received by the Google sheet. I established that pure size of an app in terms of blocks was not an explanation when I found one of my small test apps (LOGINVAs) also failed to have its message consistently received by the Google Sheet. I attach it here, with the URL that I use removed, for security. I have made sure that the URL used in all the apps that I tested was the same.
I am asking if those with more experience of communication using the Web component can please explain this behaviour, and possibly supply a solution, without which I will not be able to count on the Web component to send my data consistently to my Google Sheet storage.
loginVAs_copy.aia (3.6 KB)