title: "The coordinates or dimensions of the range are invalid"
body: <p>I am working on a Google Apps Script that links with a REST API and puts the data into a Google Sheet.</p>
  
  <p>I have successfully done this once, but upon accessing some different data I get the error message</p>
  
  <blockquote>
    <p>"The coordinates or dimensions of the range are invalid"</p>
  </blockquote>
  
  <p>when they work perfectly fine on my other script. All data accessed is JSON so I am bit confused and is from the same source. The code I am using is:</p>
  
  <pre><code>function stats () {
    var logIn = {
      "Authorization" : "Basic " + Utilities.base64Encode("XXXX" + ':' + "XXXX")
    };
  
    var url = "XXXXX";
    var params = {
      "method":"GET",
      "headers":logIn, };
  
    var response = UrlFetchApp.fetch(url, params);
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("XXXX");              
  
    var dataAll = JSON.parse(response.getContentText()); //
    var dataSet = dataAll;
  
    var rows = [],
        data;
  
    for (i = 0; i &lt; dataSet.length; i++) {
      data = dataSet[i];
      rows.push([XXXX]); //your JSON entities here
    }
  
    dataRange = sheet.getRange(1, 1, rows.length, 1); 
    dataRange.setValues(rows);
  }
  </code></pre>
  
  <p>I have combined pieces of code from around the web and this works on my other script. The error appears on this line:</p>
  
  <pre><code>dataRange = sheet.getRange(1, 1, rows.length, 1);
  </code></pre>
  
  <p>I believe the issue is with the data I am accessing but I do not know how to alter the script for it to work. </p>
  
  <p>The JSON data that works is shown like:</p>
  
  <pre><code>{
    id: XXX,
    group: XX,
    text: "XXXX?",
    creation_date: XXXX,
    created_by: "XXXXX",
    tags: [
      "XXXX"
    ]
  }
  </code></pre>
  
  <p>And the data that is causing the error is shown as: </p>
  
  <pre><code>    {
        2016-02-29: {
        XXX: 0,
        XXX: 0
      },
  </code></pre>
  
  <p>I have had to 'XXXX' out a lot of the private information - apologies. Any help would be appreciated. </p>