title: Get the spreadsheet key that is in the URL. Not ss.getId()
body: <p>How to get the spreadsheet ID that is in the URL. 
  I know about using SpreadsheetApp.getActiveSpreadsheet().getId() and SpreadsheetApp.getActiveSpreadsheet().getUrl()</p>
  
  <p>But getId()/getUrl()/getKey() now fails with Google-Drive-SDK. I am no longer able to 
  use this ID to open files with the Drive-SDK. It was working about 1 week ago, but the Drive-SDK now fails to open the file. </p>
  
  <p>A workaround is to use the ID that is in the URL. The id after key=</p>
  
  <p><a href="https://docs.google.com/spreadsheet/ccc?key=0AkGlO9jJLGO8dHJrSE0wTEF2VXRSdGRlNVQaaVRad0E" rel="nofollow">https://docs.google.com/spreadsheet/ccc?key=0AkGlO9jJLGO8dHJrSE0wTEF2VXRSdGRlNVQaaVRad0E</a></p>
  
  <p>But I want an automated way to get it, not
  a manual process. As the spreadsheet is being created using a template, so I don't have a way to know the ID. Thoughts, is there a way to get it?</p>
  
  <p>Note 1: stackoverflow.com/questions/18583885/ says Google Drive SDK issues should be posted to stackoverflow </p>
  
  <p>Note 2: getUrl() and getKey() contains the same ID as getId() not the key in the URL. So it looks like access to the key has been removed, so am not holding out much hope.</p>
  
  <h2>Edit</h2>
  
  <p>The drive code, is Java rather than google-apps-script. version 1.15.0-rc</p>
  
  <pre><code>    Drive driveService = new Drive.Builder(TRANSPORT, JSON_FACTORY, credential).setApplicationName("CellMaster.com.au").build();
      File file = driveService.files().get(this.spreadsheetKey).execute();
  </code></pre>
  
  <p>I think it broke sometime in the last week or so. It fails with the execute(), it produces a 404 error. It gives the error when I use with the short spreadsheetKey that is produced by google apps script. But it still works fine when I use the browser URL key value.</p>