title: Simple Google Spreadsheet For Each Loop?
body: <p>It's been a long time since I've coded. I've never looked into scripts for google spreadsheets before. I just want to make a simple effect to edit the spreadsheet. If I understand correctly, this is doable so long as you run it manually?</p>
  
  <p>The syntax is throwing me off too much. My basic goal is to set each cell in a fixed column range to equal itself plus the value in the adjacent column, and then set that second value to 0.</p>
  
  <p>My instinct would be to do something such as</p>
  
  <pre><code>CellRange[i][j] selected = C9:D13;
  for(i=0,i&lt;selectedrange.length,i++){
  SpreadsheetApp.getActiveRange().setValue(selected[i][j]+selected[i][j+1];
  SpreadsheetApp.getRange(selected[i][j+1]).setValue(0);
  }
  </code></pre>
  
  <p>That's probably terribly wrong but I feel I ought to at least throw my best guess out before asking for help.</p>