Manually generate UNIQUEID() key values

Note: If you want AppSheet to generate the primary key for you, see What is a key?

You can generate a unique value using a formula in the spreadsheet.

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)

To generate a lower-case key, use the following formula:

=LOWER(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:

  1. Copy (Ctrl+C) the formula above.
  2. Paste (Ctrl+V) into the first cell of the target range (A2).
  3. Observe the cell now has the formula that generates a unique ID and a unique ID value.
  4. Copy (Ctrl+C) the same first cell of the range (A2).
  5. Paste (Ctrl+V) into all cells in the range (A2:A10).
  6. Observe each cell now has the formula that generates a unique ID and its own unique ID value.
  7. Copy (Ctrl+C) all the same cells in the range (A2:A10).
  8. Paste as plain text (Shift+Ctrl+V) into the very same cells in the range (A2:A10).
  9. Observe the formula in each cell has been replaced with the unique ID the formula had generated, rendering the ID permanent.
Was this helpful?
How can we improve it?

Need more help?

Try these next steps:

Clear search
Close search
Google apps
Main menu
Search Help Center