Multi question survey app

Hello, I have to build a multi question survey app for my M.S. degree and would like if anyone would be so kind as to give some indications how I should proceed. My thought on this is collecting information from users then sending it to a Google Spreadsheet , do you think this is a good approach or I should look at another option?

Cheers!

You could use a google form (in the background) to send the data directly to a google sheet:

Thank you very much! I'll give it a try :slight_smile:

Hi, I have been experimenting with a very simple design trying to send CheckBoxes data to a Google spreadsheet, I have given all necessary permissions to my spreadsheet, also I have written a script to handle the process though I cannot make it work.
Here is my script and my blocks, could you please give me an idea what should be corrected?

function doGet(e) {
return handleRequest(e);
}

function doPost(e) {
return handleRequest(e);
}

function handleRequest(e) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = e.parameter;

sheet.appendRow([data.name, data.checkbox1]);
return ContentService.createTextOutput("Success");
}

blocks

You cannot send data to a published spreadsheet url.

Thank you very much, I have modified my script and my blocks and still I cannot get it to work, here is my script an my blocks, could you please take a look at them?

function doGet(e) {
return handleRequest(e);
}

function doPost(e) {
return handleRequest(e);
}

function handleRequest(e) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = e.parameter;

sheet.appendRow([data.checkbox1, data.checkbox2, data.checkbox3]);

return ContentService.createTextOutput("Success");
}

blocks

Remove the return from each of the above.

Ensure that your script is correctly deployed.

Also, you do realise you are sending the true/false status of each checkbox ?

Thank you very much for response, I am trying to make a survey app, that is I have several check boxes corresponding to different questions, some of these check-boxes won't have a response while others will be checked, only true values should be sent to the spreadsheet, is my approach correct?

Nothing wrong with what you are doing, just checking that that was what you intended.

I have rearranged my blocks and tested my script and still I can't send my checked values to my spreadsheet, when I run my script with its URL I don't see any error messages, though when I run the script on the editor I get the following message:

TypeError: Cannot read properties of undefined (reading 'parameter')

Here is my script, my blocks and an image of the spreadsheet, could you please give me some indication as to what I should change?

function doGet(e) {
return handleRequest(e);
}

function doGet(e) {
handleRequest(e);
}

function doPost(e) {
handleRequest(e);
}

function handleRequest(e) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = e.parameter;
sheet.appendRow([data.checkbox1, data.checkbox2]);
return ContentService.createTextOutput("Success");
}

blocks

Two things:

  1. Remove the first doGet(e) function, you do not need two.
function doGet(e) {
handleRequest(e);
}

function doPost(e) {
handleRequest(e);
}

function handleRequest(e) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = e.parameter;
sheet.appendRow([data.checkbox1, data.checkbox2]);
return ContentService.createTextOutput("Success");
}
  1. You need to provide parameters and values in your POSTText (sorry, wasn't paying attention last time around :upside_down_face:) :

image

You are awesome! now I can send my data to my spreadsheet, I'll just keep working on it, once it is finished I'll share it so everyone can benefit from it. :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.