Editing a google doc form submission? - google-apps-script

I submitted a response to a google form I was sent. I had the option to edit it afterwards however I didn't save the URL.
Is there anyway to find the URL or to edit my submission?

It is possible to get the edit response URL on submission.* (And have it written to a sheet, or emailed.)
In your case however, if you want to edit your previous response you can go to the form using the same url. (If it is limited to one response, you should have an option to edit your response.)
Using Google App Script

Related

how to know if a Google Form has been submitted by the user in a web app

I would like to use Google Forms in my webapp to run quizzes.
The Google Form is created.
I use the pre-fill option to get a URL.
From my web app I create an iframe and pass the URL (different for each user) by passing the user-id to the form.
User now fills the form and submits.
The data is stored in a spreadsheet.
Earlier I publish the spreadsheet (thereby making it public).
I can now access the spreadsheet data and update my local database.
So currently, when the user submits (from within Google Form) there is no way my web app knows about it. (I have browsed the internet for solutions but did not find any).
Is there a way to get around this?
Currently, at some "stage" in the web app, I check if the user form data is available in the database. If not, I check the spreadsheet for that user data. If found, update the webapp database. So in that sense the webapp uses a pull-feature to check for updates.
Thanks
I see that you want to know when a new Form response has been uploaded. If my understanding of the question is correct, then you could use a simple .onEdit() trigger in the response Sheet. As an alternative, you could use a FormResponse.submit() installable trigger that fires at each response. Please keep in mind that triggers are limited to form uploads that don't fire from API requests and script executions, as detailed here. Please, don't hesitate to ask for further clarification.
UPDATE
Based on your last comment I get that your priority is to see the response Sheet updated in real time. If my understanding of the issue is correct, then you can show the responses Sheet directly in a webapp inside an iframe. Please, ask me any question if you have doubts about this approach.

Make a new response from an existing Google Form response

I have studied this question and found it helpful:
How do I edit the response of a form submission in Google Forms/Sheets?
Now I would like to take it a step further. Once I have the editable response URL, I notice that when I go to the URL and edit and submit the response, it modifies the original response line in the sheet.
What if, instead of modifying, I want to make a NEW response. That is, upon editing, when I Submit, the set of responses makes a NEW row in the spreadsheet. I'm trying to think of a way I can do this, but not coming up with anything. Any ideas?

Editing Form Responses Programmatically

I have a google script that generates the edit URLs for each form response that is dumped into my spreadsheet. Is there a way to programatically change the response values as if I had actually opened the URL and changed the values manually?
For example, suppose someone submitted a form with the name field being "Sam." I want to be able to programmatically edit this response so that the value of the same field is "Samuel."
This is very easy to do manually via the form response edit url, however I am running into issues trying to do this in my scripts.

Use Apps Script to change the response of a single form item directly (programmatically) rather than using the edit response urlj

I am using a form to collect booking details and have the script attached to the form (so that the form submit trigger will trigger when the response is edited, which the spreadsheet bound version does not allow) which sends an email, schedules calendar events, creates confirmation documents etc on form submit. Using if statements I have provided the user the ability to avoid 'click the box to not send the customer an email on submit' functionality so that the form responses can be edited without triggers the automated functions, but that relies on the user remembering to click those boxes.
A better solution would be to be able to have the script, as its final function, change the item response, so that when the form is edited in future, the automatic functions are already disabled.
I do not want to create a new form response (although it would be possible to tweak the pre-populated url to create a duplicate with the appropriate changes)
FormResponse.withItemResponse(response) specifies that it doesn't work on stored responses
It is so easy to view form responses, and with the native edit response url functionality I figured editing a single item response would be doable, but so far it has eluded me.
Is there a way to do this?
Thanks
At this time Form responses could only be created programmatically, they can't be edited programmatically. Consider to submit a feature request through Google Apps Script Issues

Any way to validate a Google form input?

I want to collect and validate a value (PIN) in a Google Form. The Form has 2 pages, and I'd like the validation to affect form navigation:
If PIN matched with a value in Column N of the response sheet, continue to page 2 of the form
If PIN not matched, Do not continue.
Can this be done with Google Apps Script?
You are not able to create this type of dynamic form using the Google Forms Service, because there is no interaction between the service and scripts during form entry, except upon Form Submission. In the case of a multi-page form, a script has no way to know that a user has completed one page and gone on to another.
You could achieve this using the HtmlService or UiService, by writing your own form.
Not sure you can do this with Google Forms and Apps Script.
But I have done exactly this with UiApp/Html Service in Apps Script. I used it for a light-duty user authentication.