title: google script - json into google sheet
body: <p>I'm new to scripting and I would appreciate your help. I do apologize for what might be a simple question.</p>
  
  <p>What I have is an api that gives json:</p>
  
  <p>[{"id":"xyz","name":"xy"},
   {"id":"zyx","name":"yx"}]</p>
  
  <p>The above continues lets say for another 100 ids.</p>
  
  <p>What I want is to put that into the cells in google spreadsheet.</p>
  
  <p>What I have currently is:</p>
  
  <pre><code>var ss = SpreadsheetApp.getActive();
  var sh = ss.getActiveSheet();
  var rr = sh.getRange(3,2,100,5);
  
  var id = "www.xyz.com/api";
  var jsonData = UrlFetchApp.fetch(id);
  var jsonString = jsonData.getContentText();
  var idsearch = JSON.parse(jsonString);
  
  for (var i = 1; i &lt; idsearch.count; i++)
    {
       var cellid = rr.getCell(i,1);
       eventid.setValue(idsearch.results[i].id);
       var cellname = rr.getCell(i,2);
       eventname.setValue(idsearch.results[i].name);
    }
  </code></pre>
  
  <p>When I run the script, nothing happens. It doesnt return anything.</p>
  
  <p>Did I make a mistake in the script? Is there an easier way to put all the json result into google sheet? Is there an example where I can look at to learn about what I'm trying to do?</p>
  
  <p>Thank you very much.</p>