title: Service Error: Spreadsheets on Google Scripts
body: <p><strong>Scope</strong></p>
  
  <p>I started to write an script that will make chained calls to an API (with a JSON response) and write the result into a Spreadsheet.</p>
  
  <p><strong>What Happens:</strong></p>
  
  <p>Once i debug the script code, it runs just fine, with no major problem, but once i run it from the Spreadsheet button itself (from the menu i created) it runs some steps of the script and than, pops a : <code>Service Error: Spreadsheet</code> with no other error details.</p>
  
  <p><strong>Weirdness</strong></p>
  
  <p>I Started to "Log" the current step of the process to a Spreadsheet cell, so that i can monitor its progress while running the script out of the debugger.</p>
  
  <p>The problem is, once i move some "random" pieces such as : </p>
  
  <pre><code>sheet.getRange("F2").setValue(currentPage);
  </code></pre>
  
  <p>the code tends to break in different points.</p>
  
  <p><strong>Code Sample :</strong></p>
  
  <p>You can find a code to reproduce the issue here : <a href="http://pastebin.com/HjmSwEYZ" rel="noreferrer">http://pastebin.com/HjmSwEYZ</a></p>
  
  <p>All you have to do is :</p>
  
  <p>1 - Create a new Spreadsheet on Google Drive</p>
  
  <p>2 - Hit Tools -> Script Editor</p>
  
  <p>3 - Create a new Script, paste the code in, and save</p>
  
  <p>4 - Reload the Spreadsheet (F5) so that the custom menu will now appear "Guild Wars 2 Tracker"</p>
  
  <p>5 - Click the button and hit "List All"</p>
  
  <p><strong>Desired Output:</strong></p>
  
  <p>What this code <strong>should (if it wasn't for this error)</strong> do is :</p>
  
  <p>1 - Execute a request on this url : <a href="http://www.gw2spidy.com/api/v0.9/json/items/all/1" rel="noreferrer">http://www.gw2spidy.com/api/v0.9/json/items/all/1</a>  (which will return the first page of Guild Wars 2 itens)</p>
  
  <p>2 - Iterates over each page, parsing the json and writing the returned values into the Spreadsheet</p>
  
  <p><strong>Disclaimer:</strong></p>
  
  <p>Sorry about all the "Log" messages in the sheet. This was a desperate attempt to track my progress, i know i should't do this.</p>
  
  <p>Thanks in advance</p>
  
  <p><strong>Update 1:</strong></p>
  
  <p>After creating another Spreadsheet and pasting the pastebin code in its own Script Project i could run it for on interaction, but that was it. This time thus, it raised a different error : <code>We're sorry, a server error occurred. Please wait a bit and try again.</code></p>