How to generate an uuid in google sheet?

前端 未结 6 1691
花落未央
花落未央 2021-02-04 02:24

How to generate an uuid in google sheet (for exemple ccb8a660-91c9-a556-58e0-4fa7-229516872004).

Either with a macro? or a formula?

6条回答
  •  孤独总比滥情好
    2021-02-04 03:13

    the created uuid is changed with the time.

    I think this problem could not be solved without using the Apps Script.
    For example:

    var sheet = SpreadsheetApp.getActiveSheet();
    var values = sheet.getRange('A1:A10').getValues();
    
    for (var i = 0; i < values.length; i++) {
      // When a cell is empty, set a uuid to the cell.
      if (!values[i][0]) {
        sheet.getRange('A' + (1 + i)).setValue(Utilities.getUuid());
      }
    }
    

提交回复
热议问题