Can AppSheet auto-generate the Unique ID column in my worksheet?

I have been having issues creating my first app through AppSheet. Is it possible for AppSheet to generate a unique ID for me, if I create the column but donโ€™t have any info in the field? Or is there a function or formula I can use to get my sheet to populate a random ID whenever I create a new row of text? I have tried everything I can think of and all of it creates errors on my sheet or in the app. Please help!

1 14 17.9K
14 REPLIES 14

Hi @Dunrite
You need a Column for the Unique ID . Use that as key column.
Edit the column definition and if it is not already there put UNIQUEID() in initial value.


Thank you, Lynn. I had already done all of that. But it doesnโ€™t create a Unique ID for me. It just gives me an error and tells me I need to create an ID.

you must put UNIQUEID () in initial value

No, you havenโ€™t.

probably the question is, how to fill uniqueID for existing data?, I did the exercise and it generates the ID for new added data, but not for existing one

excellent, thank you

From what you have said I think you are trying to make a sheet of data that you already have work in Appsheet?

I would insert a new column in your sheet at column A and give it a column header of ID (or something like that).

Then put this formula in A2

=MID("abcdefghijklmnopqrstuvwxyz",INT(RANDBETWEEN(1,26)),1)&DEC2HEX(RANDBETWEEN(0, 4294967295), ๐Ÿ˜Ž

Copy that formula down until the last line of data in your sheet.

Then highlight the whole of that column again and copy it to the clipboard (Ctrl+C)

Paste the 'Values only' copy off the clipboard back over the whole column so that the formula gets replaced only by it's values (Ctrl+Shift+V)

Now in Appsheet, Regenerate the structure of the table so that your new column ID (or whatever you called it) appears in Appsheet.

You now have your unique values for data that is already in the sheet and you can then follow the UNIQUEID() parts of the already given information so that Appsheet will now create a unique id for every NEW row that is added via Appsheet.

 

Hi, I have the same issue. And if I use your formula to create IDs in Sheets I get an error message (error parsing the formula). Same with the other formulas provided in the help section for creating Unique IDs. Whatห‹s my mistake? I strictly copied, no changes, no misses.

If you don't have any demands what your key values are, you can just add 0001 etc. and drag it down. They don't need to be 8 digits.. just unique values. Then you can start to use UNIQUEID() with the initial value.

I just tried this in Google Sheets (same as posted above without the trailing comma)

=MID("abcdefghijklmnopqrstuvwxyz",INT(RANDBETWEEN(1,26)),1)&DEC2HEX(RANDBETWEEN(0, 4294967295))

and it worked just fine.

Maybe you can post a screenshot similar to below showing what the formula looks like and the error message. One possibility is the copy and paste is messing up the double quotes and you may have to delete them and type them in from the keyboard.

dntrplytch_0-1712868544650.png

 

Most of my data is from form responses from my website synched to my sheet so if I prefill any columns with an ID creating formula it will just get overridden during the update. I can't seem to get the form to create the ID upon entry, nor can I get Appsheet to add one if the data wasn't added by Appsheet, and I can't seem to get Appsheet to be the form...

There are probably a few options (not mutually exclusive).

thankyou! I would love to use Google Forms but for some bizarre reason you can't use Googles Places API to autofill addresses for people! I've only been able to get that to work in Contact Form 7, which is what I'm using now. I'm trying out your suggestion of just having another tab in sheets that can copy over and manipulate the form response data, so far so good. thanks  again

Top Labels in this Space