I have a Google Form which outputs responses to a Google Sheet. Some of my form questions have long paragraph responses, so I'd like to be able to click a link on each row from my tracking sheet and have it open the original response page as seen from the Form's "responses" tab.
The URL I'm trying to generate, which I get by going to Responses -> Individual from my Form, looks like:
https://docs.google.com/forms/d/<form_id>/edit#response=<response_id>
I have looked at the FormResponse
API documentation, but I can't manage to extract the same ID used by the Google Form viewer from a FormResponse
object. While I know the appropriate form ID, the response ID that is valid for that URL isn't the same one returned by either FormResponse.getId()
or as part of FormResponse.getEditResponseUrl()
. In other words, I can't get the data from the Forms API that's needed to generate that link. I'd rather not use edit links, which they do support generating, to view my responses.
My end goal is to have a link with the format shown above, in each row of my response form. A correct link with that format brings you to the individual response viewer page for the particular response in that row. i.e., I'd like to turn this:
+-----------+------------+
|Question 1 | Question 2 |
+-----------+------------+
|Long answer| Another ans|
+-----------+------------+
|One more an| Additional |
+-----------+------------+
Into this
+-----------+------------+------------------------------------------------------------+
|Question 1 | Question 2 | View link |
+-----------+------------+------------------------------------------------------------+
|Long answer| Another ans| https://docs.google.com/forms/d/abc123/edit#response=def456|
+-----------+------------+------------------------------------------------------------+
|One more an| Additional | https://docs.google.com/forms/d/abc123/edit#response=ghi789|
+-----------+------------+------------------------------------------------------------+
For reference, I tried generating the URL as "https://docs.google.com/forms/d/" + formId + "/edit#response=" + responses[i].getId()
, but when visiting that URL it says the response ID is invalid.
Is there a way, either via an Apps Script or other configuration, to produce a link back to each individual response in my output sheet?