Google Sheets API v4 to get all sheet names in a worksheet
<p>I am using the javascript code as provided in the quickstart section of <a href="https://developers.google.com/sheets/quickstart/js" rel="nofollow">https://developers.google.com/sheets/quickstart/js</a></p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function listMajors() {
       gapi.client.sheets.spreadsheets.values.get({
          spreadsheetId: '1b05r8p74UzLh_Hk8119stG8yEoU6Utsr1L238BwssWU',
          range: 'Class Data!A2:E',
        }).then(function(response) {
          var range = response.result;
          if (range.values.length &gt; 0) {
            appendPre('Name, Major:');
            for (i = 0; i &lt; range.values.length; i++) {
              var row = range.values[i];
              // Print columns A and E, which correspond to indices 0 and 4.
              appendPre(row[0] + ', ' + row[4]);
            }
          } else {
            appendPre('No data found.');
          }
        }, function(response) {
          appendPre('Error: ' + response.result.error.message);
        });
      }</code></pre>
</div>
</div>
</p>

<p>gives me data in the specified range: Class Data!A2:E.</p>

<p>I now want to list all the sheets (like the one: Class Data) available in a spreadsheet. Please help.</p>