I have created an application where I am collecting form responses from various users. I am getting responses with email id
in responses spreadsheet. As I don't want to store data in spreadsheet so I am reading data trough responses. I am facing some challenges please guide.
Query 1
while using onFormSubmit(e)
I am not able to read submitted form, given code is returning null:
var form = FormApp.getActiveForm();
Logger.log('usename:' + form.getId());
error " Cannot call method "getId" of null." although if I hard coded value of formid var form = FormApp.openById('<<form_id_xyz>>');
then it is working fine and I can read responses as well.
How can I get form responses for multiple users?
Query 2
getRespondentEmail();
is not working in my case. Even I use form id <<form_id_xyz>> and trying to get email id from responses which I have captured at the time of form submission form.setCollectEmail(true);
I tried following code in onFormSubmit(e)
function but dint get a result:
var formResponse=form.response;
Logger.log('email id of user: ' + formResponses.getRespondentEmail());
and another way:
Logger.log('email id of user: ' + form.getRespondentEmail());
and
Logger.log('email id of user: ' + e.values[1]);
nothing works for me. Kindly guide.