3

How do I get responseId ?

var form = FormApp.openById('myGoogleFormID');
var response = form.getResponse(responseId);

function onSubmit() {
  // Here I'd like to get the id of the current response
}

I'd like to the the current id of the response in order to manage a spreadsheet based on the values that were entered.

3

You can use this code.

Code

function onFormSubmit(e) {
  var responses = e.response;
  var lastResponse = responses[responses.length - 1];

  Logger.log(lastResponse.getId());
}

I wasn't able to find a clear cut solution, thus ended up with this. It will simply get the IDof the last entry

  • 1
    I ended up using the same approach as you but my case is quite friendly because the number of responses are always the same; so I can count on some constants for the indexes. itemResponses[INDEX_NUMBER].getResponse(); – el.severo Feb 26 '14 at 23:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.