title: How do I run through rows and fetch the value of a cell, if another cell is true?
body: <p>In Google Sheets, I have X rows with data in 10 columns. The first row contain headers.</p>
  <p>I need to run through every row in my current sheet, check column B, in the current row, and if the value of that cell is &quot;FOUND&quot;, then I want to fetch the value of the cell in column C, in the current row.</p>
  <p>I have this experimental code, but it doesn't work properly, as it returns all incidences regardless of values:</p>
  <pre><code>function curCellValue() {
    var sheet = SpreadsheetApp.getActiveSheet();
    var data = sheet.getDataRange().getValues();
    for (var i = 1; i &lt; data.length; i++) {
      if (data[i][1] = 'FOUND'){
        Logger.log(data[i][2]);
      }
    }
  }
  </code></pre>