I have done this but it is still not working. There is no data saved on google sheet.
This is sad
I have just set up a test project which works for me.
I see you are using the legacy editor.
For the script, when publishing for the first time I set the script to run as Me
(my google account) and for it to be accessible by Anyone, even anonymous
. This is the only way a google apps script will work with AI2.
I used this script:
function doPost(e) {
var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1si756vNKC8z3cNCKlPcQGlMc1pmn7vuqHtRc2dLUnck/edit#gid=0");
var sh = ss.getSheetByName("Sheet1");
var Sensor = e.parameter.Sensor;
var Voltage = e.parameter.Voltage;
sh.appendRow([Sensor,Voltage]);
return ContentService.createTextOutput('data appended');
}
and these blocks
when I run the app in companion and click Button 1, the data appears in my google sheet
and data appended
appears in label1.Text.
You might also read this:
Ok..I will just try that now.
Note that in the example link above I use doGet(e). In your project we are using doPost(e).
You cannot test doPost(e) in your computer browser
please can you come again. do you mean the script. because i used doGet(e) in the first part. and doPost(e) in the second.
function doPost(e) {
var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1si756vNKC8z3cNCKlPcQGlMc1pmn7vuqHtRc2dLUnck/edit#gid=0");
var sh = ss.getSheetByName("Sheet1");
var Sensor = e.parameter.Sensor;
var Voltage = e.parameter.Voltage;
sh.appendRow([Sensor,Voltage]);
return ContentService.createTextOutput('data appended');
}
You only need to use the script content I posted above, you do not need the doGet(e).
Yes, just that, and nothing else....
Ok.. I will do that
Remember, every time you change your code in the google apps script, you must republish your web app, selecting New
under Project version: in the dialog, then clicking the Update button.
Hooray
Now I need to hand you back to @ChrisWard who can help you get your arduino data to fit into the PostText blocks
Ok.. I very much appreciate your time and efforts. However, I still need to get EMG sensor values to google sheet. that is still in contention. I trying my best to implement it.
Hello, @TIMAI2 @ChrisWard Thanks for you help. I am now able to figure out how to send the EMG sensor data to google sheet. The next part of my project is to plot the signal using the canvas. I have done some and still need your support again.
You might consider:
to chart your values....
Hi Anthony
We have moved along with you on your Topic as an expedience - you happened to get two Power Users that could help with (1) Bluetooth and (2) Uploading to a Google Sheet. However, they are separate subjects and should have been separate Topics. Like wise, Charting data is a separate subject and should be a separate Topic.
There are two reasons:
- Your Topic will get a better response from the experts of the particular subject field.
- Other Users searching the Forum for a specific subject will be more likely to find the Topics on that subject.
It's important to us because App Inventor has well over 400,000 unique active Users per month and we are a small team of volunteers.
Ok..thank you for the information. I am now trying to plot the emg signals in graph form.