Google Forms – Auto Increment ID

google sheetsgoogle-apps-script

I am designing a Google Form for managing a congress registration process. I need to have a unique ID number for each registration and I found an answear here: Can I add an autoincrement field to a Google Spreadsheet based on a Google Form?

It was certainly very useful, but there is one litle problem I cannot solve. As the form has non required fields, the answears are different in length, so the ID is placed in different columns. I think the line in the code that controls the column where the ID is placed is this one:

21. var column = eventRange.getLastColumn() + 1;

Is there a way to place the ID in a specific column, say column C?

Best Answer

Just replace eventRange.getLastColum() + 1 with a number. Column A is 1, B is 2 etc.

So if you want the ID to be placed in column C, change the code to

var column = 3;