title: Returning data from single Google Sheets row from .gs file to .js file
body: <p>I am trying to create a web app in Google scripts that returns project data based on a search query. I have the search query functioning correctly, however, the returned array <code>filteredRows</code> has a length of 1 when I query it, therefore when I try to use the values based on index, they are still all together. There are 12 columns in the spreadsheet. The function is returning the correct information back to me js file though.</p>
  
  <p>I have tried <code>JSON.stringify</code> and I couldn't get it to work, but it is not something I have used before. I do suspect the answer lies there though.</p>
  
  <p>The spreadsheet may have hundreds of lines, but I only want to return one at a time for manipulation.</p>
  
  <p>Here is the code for the search function. <code>var headers</code> and <code>var cols</code> are there from trying to use the JSON method, but otherwise not doing anything right now.</p>
  
  <pre><code>function searchProject(tendNumber) {
  
     var id = 'mySpreadSheetId';
     var ss = SpreadsheetApp.openById(id);
     PropertiesService.getScriptProperties().setProperty("tend", tendNumber);
     var ws = ss.getSheetByName('Data');
     var data = ws.getRange(1, 1, ws.getLastRow(), 12).getValues();
     var headers = data[0];
     var cols = headers.length;
     Logger.log(headers);
     var filteredRows = data.filter(function(row){
     var ids = PropertiesService.getScriptProperties().getProperty("tend");
      if (row[4] == ids){
        return row;
     }
  
  })
  
   return (filteredRows);
  }
  </code></pre>
  
  <p>Any guidance as to which direction to go would be greatly appreciated. There does seem to be a lot of info available, but I need a pointer to fully understand it.</p>
  
  <p>I have edited this in case it helps others. The answer was actually simple.</p>
  
  <p>As stated all was working but I couldn’t access the indexes in the array. I wasn’t aware that it actually returns an Array of Arrays, therefore if I access array[0] it will return all of the first inner array.</p>
  
  <p>To access each individual element of the returned row or rows it is array[0][0].</p>