问题
I have a script attached to a Google Form which sends a notification to a Discord channel on submission. I want to include a direct link to the individual response (link looks like https://docs.google.com/forms/d/<myformid>/edit#response=<responseid>
). How can I retrieve that link? I get part of the link up to /edit
with Form.getEditUrl()
but I can't get the correct id. I checked FormResponse.getId()
but that doesn't link me to any response.
Here's how to get to that link manually via edit form:
回答1:
Since you know the response Id, you can use the geEditResponseUrl method to get the direct link to the form response. Do note that anyone with this URL can edit the response.
function getEditUrl(responseId) {
var form = FormApp.getActiveForm();
var response = form.getResponse(responseId);
return response.getEditResponseUrl()
}
来源:https://stackoverflow.com/questions/48368843/retrieving-the-link-to-a-response-from-a-google-form