title: How can I make a unique ID generator on Office.JS
body: <p>I'm trying to use Office.JS to insert some rows into a table, there's more to it but i'll try to keep it simple.</p>
  
  <p>The idea is to type details about a product on various inputs and then submit it to the table creating a full row with everything i've written.</p>
  
  <p>The problem is that i don't know how can i make unique IDs on Office.JS, i thought about getting the last ID on the table then just do something like:</p>
  
  <pre><code>ID = lastID + 1
  </code></pre>
  
  <p>But i don't know how to get the value from the last ID on the table (the documentation it's just incredibly hard for me to understand)</p>
  
  <p>This is what i did so far:</p>
  
  <pre><code>function run() {
    return Excel.run(function(context) {
      var sheet = context.workbook.worksheets.getItem('Principal');
      var mainTable = sheet.tables.getItem("Main");
  
      var local = $('#local').val();
      var tipo = $('#tipo').val();
      var modelo = $('#modelo').val();
      var notas = $('#notas').val();
      var lote = $('#lote').val();
      var custo = $('#custo').val();
      var preco = $('#preco').val();
      var estado = $('#estado').val();
  
      var produto = [data, id, local, tipo, modelo, notas, lote, custo, preco, estado];
  
      var id = ""
  
      mainTable.rows.add(null, [produto]);
  
      return context.sync().then(function() {
        console.log(produto);
      });
    });
  }
  </code></pre>
  
  <p>Every column that i have in it's sequence:</p>
  
  <ol>
  <li>Date</li>
  <li>ID</li>
  <li>Local</li>
  <li>Tipo</li>
  <li>Modelo</li>
  <li>Notas</li>
  <li>Lote</li>
  <li>Custo</li>
  <li>Preço</li>
  <li>Estado</li>
  </ol>
  
  <p>The weird names are just because i'm brazilian.</p>
  
  <p>(First time asking a question here)</p>