If you want AppSheet to generate the primary key for you, please check this article instead.
If you want to generate a unique value via a formula in the spreadsheet, read the instructions below.
The following spreadsheet formula, suitable for Microsoft Excel and Google Sheets, will generate a unique ID consistent with those generated by AppSheet's UNIQUEID() function:
=DEC2HEX(RANDBETWEEN(0, 4294967295), 8)
An ID must be a value, not a formula, though, so copy (Ctrl+C) and paste as plain text (Shift+Ctrl+V) the result of the formula calculation into the cell meant to contain the new ID. That's all there is to it!
For example, to generate a set of new IDs in column A for rows 2 through 10:
- Copy (Ctrl+C) the formula above.
- Paste (Ctrl+V) into the first cell of the target range (A2).
- Observe the cell now has the formula that generates a unique ID and a unique ID value.
- Copy (Ctrl+C) the same first cell of the range (A2).
- Paste (Ctrl+V) into all cells in the range (A2:A10).
- Observe each cell now has the formula that generates a unique ID and its own unique ID value.
- Copy (Ctrl+C) all the same cells in the range (A2:A10).
- Paste as plain text (Shift+Ctrl+V) into the very same cells in the range (A2:A10).
- Observe the formula in each cell has been replaced with the unique ID the formula had generated, rendering the ID permanent.