I use a Google Form to retrieve feedback from our customers. I then download this info into our offline system.
Is it possible in Google Form 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.
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:
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.
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 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.