I have a Stats project where we need to collect at least 30 data points each from 4 groups on an online form that I made. Pipedream would be my ideal choice for this, except I only get 100 free credits (workflow runs) per month and I've already used like 60 for testing. I tried looking into the Google Sheets API documentation, as well as gapi, but I can't make anything out.
I have an online form that will send a POST request with the data in the request body as JSON to a server. There are 8 different data points, which each go into their respective columns in the sheet (A-G).
Would Firebase be good thing to use here? Some other automation tool? The one thing that I know will work is sending serialized JSON to a Google Chat webhook, but that hardly seems adequate.
I would really like to directly work with Google Sheets, but I can pretty much work with any method that remotely stores data which I can parse on my end.
Overall, I need some way to append arbitrary data to a row in a Google Sheet.
Sheetdb worked for me (not affiliated). It has a really nice REST API, and you have 500 free requests per month.
You can append a row of data to a Google Sheet like so:
fetch('https://sheetdb.io/api/v1/58f61be4dda40' /* their testing Sheet */, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: [
{
'id': "INCREMENT", // finds the highest element in the column and adds 1
'name': "Mark",
'age': 18
}
]
})
})
.then((response) => response.json())
.then((data) => console.log(data));
...assuming id
, name
, and age
are all string cells in row 1.