title: Query specific sheets of a google spreadsheet
body: <p>I am attempting to use a google spreadsheet as a temporary database. I have followed the instructions at the folowing tutorial and everything is working fine</p>
  
  <p><a href="http://www.alatechsource.org/blog/2012/05/using-the-google-spreadsheets-data-api-to-build-a-recommended-reading-list-code-words.h" rel="nofollow">http://www.alatechsource.org/blog/2012/05/using-the-google-spreadsheets-data-api-to-build-a-recommended-reading-list-code-words.h</a></p>
  
  <p>The jquery that gets the data I have copied below for ref</p>
  
  <p>I wondered if it would be possible (using the same or similar code), assuming there are multiple sheets within the spreadsheet to query just one at a time. So for example you could run the below code but only for say sheet 4.</p>
  
  <p>I have tried adding sheet ref # from the web URL (i.e #gid=1) at the end of the numeric code so </p>
  
  <p>"<a href="https://spreadsheets.google.com/feeds/list/0Ak0qDiMLT3XddHlNempadUs1djdkQ0tFLWF6ci1rUUE/od6/public/values?alt=json-in-script&amp;callback=" rel="nofollow">https://spreadsheets.google.com/feeds/list/0Ak0qDiMLT3XddHlNempadUs1djdkQ0tFLWF6ci1rUUE/od6/public/values?alt=json-in-script&amp;callback=</a>?"</p>
  
  <p>becomes</p>
  
  <p>"<a href="https://spreadsheets.google.com/feeds/list/0Ak0qDiMLT3XddHlNempadUs1djdkQ0tFLWF6ci1rUUE#gid=1/od6/public/values?alt=json-in-script&amp;callback=" rel="nofollow">https://spreadsheets.google.com/feeds/list/0Ak0qDiMLT3XddHlNempadUs1djdkQ0tFLWF6ci1rUUE#gid=1/od6/public/values?alt=json-in-script&amp;callback=</a>?"</p>
  
  <p>but this does not work, the code only seems to loop through the first sheet</p>
  
  <p>Can anyone advise on this?</p>
  
  <p>Any help is much appreciated</p>
  
  <pre><code>&lt;script type="text/javascript"&gt; 
  $(document).ready(function() {  
  
  //source file is https://docs.google.com/spreadsheet/ccc?    key=0Ak0qDiMLT3XddHlNempadUs1djdkQ0tFLWF6ci1rUUE   
  $(function listBooks() {    
  
  $.getJSON( "https://spreadsheets.google.com/feeds/list/0Ak0qDiMLT3XddHlNempadUs1djdkQ0tFLWF6ci1rUUE/od6/public/values?alt=json-in-script&amp;callback=?",
  
  function (data) {   
  
      $('div#book-list').append('&lt;ul class="items"&gt;&lt;/ul&gt;');
  
      $.each(data.feed.entry, function(i,entry) { 
  
          var item = '&lt;span style="display:none"&gt;' + entry.id.$t + '&lt;/span&gt;'; 
  
          item += '&lt;img src="http://covers.openlibrary.org/b/isbn/' + entry.gsx$isbn.$t + '-S.jpg"/&gt;';
  
          item += '&lt;span class="meta"&gt;&lt;a href="http://www.worldcat.org/isbn/' + entry.gsx$isbn.$t + '"&gt;' + entry.title.$t + '&lt;/a&gt;';   
  
          item += '&lt;br/&gt;Author: ' + entry.gsx$author.$t;  
  
          if (entry.gsx$notes.$t) {   
  
              item += '&lt;br/&gt;Description: ' + entry.gsx$notes.$t;  
  
          }   
  
          $('.items').append('&lt;li&gt;' + item + '&lt;/span&gt;&lt;/li&gt;'); 
  
          });
  
      });
  
  });
  
     });
  
  
     &lt;/script&gt;
  </code></pre>