title: Ordering a Google Sheet based on a column
body: <p>Im using the Google Sheets API to call a sheet. I can successfully ingest the data and get it to appear in browser. Right now its coming in the order of the sheet, ie row 1, 2, 3, 4.</p>
  
  <p>I want to change the order when queried. Looked at the docs and it seems I am supposed to use the sortSpecs option, but its not changing the order. It just keeps coming in based on the Sheet row order. Heres the code:</p>
  
  <pre><code>    function getSheetData() {
      gapi.client.sheets.spreadsheets.values.get({
            spreadsheetId: 'sheetID',
            range: 'Sheet!A2:I',
            sortSpecs: [
                {
                  "dimensionIndex": 5,
                  "sortOrder": "DESCENDING"
                },
              ]
          }).then(function(response) {
            var range = response.result;
            if (range.values.length &gt; 0) {
              for (i = 0; i &lt; range.values.length; i++) {
                  var row            = range.values[i];
                  var name           = row[0];
                  var bio            = row[1];
                  var site           = row[2];
                  var title          = row[3];
                  var description    = row[4];
                  var location       = row[5];
                  var time           = row[6];
                  var slug           = row[7];
      });
    }
  </code></pre>
  
  <p>This is all coming in vanilla javascript. I run this function after I have successfully connected to the API, so it seems all is setup correctly from an API perspective. I just need to maniupulate the order based on a column value.</p>