Is it possible in Google Forms to give a unique value to each row it inserts into the spreadsheet as well as the timestamp?
You can do this by adding a script trigger.
Supposing your current Form has two columns
You need to first go to
In the Script Editor window enter the following script:
Save the script and then go to the
Populate the drop downs as follows:
Then Save and close the Google App Script window.
Now when your form is submitted it will populate the row number in column C along with the data that has been submitted via your form.
In you want to change the column that the row number gets saved to you need to change this line of the script:
and change the value 3 to the corresponding column index number.
Further to the excellent answer by Barry, if you want to be able to remove rows, and still keep a unique ID you can have a static cell that maintains a count. You can then use this number and increment it on every new entry to the table.
So the modification would be to keep a number somewhere on your spreadsheet ('M1' in the code below) and modify the code to look like this:
Again, change the second last line to change where your ID is placed.
Building on both previous answers (from Barry and Danny):
Assuming the ID column is column A. Pick a "Next ID" cell and set it to the following formula (assuming it is in "P1"):
Create script using the script editor under the "Tools" menu, and paste in the following:
Add a script trigger using the "Triggers" menu in the script editor:
Further to the above answers - This solution doesn't require an extra spreadsheet cell.
You can use the inbuilt event handlers for submission of the form to get a unique id. Because the spreadsheet is just the destination for the form, deleting a row doesn't actually delete the response. With that in mind...
EDIT: removed need for ID and dealt with date formatting issues.
This is a derivative of the other answers but it might be useful for future users.
The main difference is it will update column 1 in the active row when that row is edited but only if there is not already a value specified.
You should set the trigger as mentioned in other answers to on edit.
For "Is it possible in Google Form to give a unique value to each row it inserts into the spreadsheet as well as the timestamp?" while also allowing for deletion of a row in the Form responses sheet before the addition of a further Response without duplicating values, this should work:
protected by Community♦ Mar 26 '15 at 5:53
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?