title: Select only the rows from a Google Spreadsheet where values or formulas in a certain column are not empty using Google Apps Scripts
body: <p>I have a Google spreadsheet and I am having real difficulty trying to work out the code I require to select a number of rows.</p>
  
  <p>The only rows I want to select are the rows that have a value <em>or</em> formula in one of the columns (lets say column B).</p>
  
  <p>I <strong>cannot</strong> order the sheet by the column and only select the first x values.</p>
  
  <p>I am thinking I need to loop through every row in the sheet and determine if column B is empty but I don't know how to do this or how to check if the cell contains a value or a formula.  If it contains a formula then this must be preserved in preference to the value.</p>
  
  <p>How do I select only the rows from a Google Spreadsheet where values or formulas in a certain column are not empty using Google Apps Scripts?</p>