title: Retrieve rows from spreadsheet data using google app script
body: <p>I am using Google app script to write form data to spreadsheet. Now I would like to fetch the values from Excel which matches conditions (eg., filtered by date, username) and display them with app script. </p>
  
  <p>My spreadsheet has </p>
  
  <pre><code>+-------------+-----------+----------------------+
  | Date        | Username  | Comment              |
  +-------------+-----------+----------------------+
  | 2012-05-02  | palani    | My first comment     |
  | 2012-05-02  | raja      | My second comment    |
  | 2012-05-03  | palani    | My third comment     |
  | 2012-05-03  | raja      | My fourth comment    |
  +-------------+-----------+----------------------+
  </code></pre>
  
  <p>Now I want to filter data for <code>2012-05-02</code> on date and <code>raja</code> on username and display them using labels in app-script (which is running as a web service).</p>
  
  <p>All my searches return solution using <a href="https://developers.google.com/apps-script/class_sheet#getDataRange" rel="noreferrer"><code>SpreadsheetApp.getActiveSheet().getDataRange();</code></a> which i think is not optimized way to display one record out of 1000+ rows in sheet.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Right now, I am using <code>.getValues()</code> only. And the data shown here is for sample; my real sheet has 15 column and 5000+ rows for now. And eventually it will grow to millions as this is a timesheet application. I am wondering is there any other way to <code>getValues()</code> of filtered rows? </p>
  
  <p>Applying <code>=Filter</code> formula on a tmp cell will also be an issue, as script could be used simultaneously by number of people.</p>