title: Google Geocoding API limit reached; code shouldn't cause it. Where is my error?
body: <p>I have a customer database in Google Sheets with a list of addresses. I'm using Geocoding to generate their longitude/latitude for easy use in Fusion Tables for mapping. I used the following code only one time, on a list of 963 customers, and it stopped on customer 761 with the "Service invoked too many times for one day: geocode" error.</p>
  
  <p>I am aware of the 2,500 daily limit for calling the Geocode API. What confuses me is that I'm not certain how this code reached that limit after 761 iterations. I've looked over it time and again and don't see how it's performing more than 1 request per iteration. I have no other similar projects and have never used the Geocode API feature until now. I'd like to prevent accidentally reaching this error in the future. </p>
  
  <p>Where have I gone wrong?</p>
  
  <pre><code>function geocodeFirstAddressFromCell(){
      var sss = SpreadsheetApp.openById('WORKBOOK ID HERE');
      var ss = sss.getSheetByName('Sheet1');
      var lastRow = ss.getLastRow();
      for (var startRow = 2; startRow &lt; lastRow; startRow++) {
          var addressCellData = ss.getRange(startRow, 13).getValue();
          var results = Maps.newGeocoder().geocode(addressCellData);
          if (results.status == 'OK') {
              var bestResult = results.results[0];
              var lat = bestResult.geometry.location.lat;
              var lng = bestResult.geometry.location.lng;
              var latLng = lat + ',' + lng;
              var addressTargetCellData = ss.getRange(startRow, 16).setValue(latLng);
              ss.getRange(startRow, 17).setValue(1);
          } else {
              Logger.log(results.status);
              return '0,0';
          }
      }
  }
  </code></pre>