Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are there two different URL formats for Google spreadsheet documents?

My app accesses private Google spreadsheet documents on behalf of an authorized user. It seems that Google's API expects developers to first request a list of all the spreadsheet documents available to an authorized user before they can get at a particular spreadsheet's keys. I wanted to find a workaround to this, and eventually did by extracting the key parameter value from URLs spreadsheet URLs that look like this:

https://docs.google.com/spreadsheet/ccc?key={some long key here}&usp=drive_web#gid=0

It was simple enough to just break down the string to point where I could retrieve key's value fairly easy without the need of a regex.

Recently, though I don't know how recent, I notice URLs to newly created Google Drive spreadsheets come in this form:

https://docs.google.com/spreadsheets/d/{some long key here}/edit#gid=0

I was also able to extract the key from this URL string, but am just curious about the difference between the two URLs:

  1. What is the significance between the two URLs.
  2. Why does Google's API force devs to first get a list of all available docs, when a dev might just want to extract a key from a direct URL to a Google Drive spreadsheet doc.

Thanks!

like image 884
ariestav Avatar asked Apr 23 '14 12:04

ariestav


1 Answers

Old style sheets

They work online only and limited to about 400,000 cells per spreadsheet.

Old style URL

 https://docs.google.com/spreadsheet/ccc?key={some long key here}&usp=drive_web#gid=0

New style sheets

Released about mid Dec 2013

Works offline and (if I remember) up to 2,000,000 cells per spreadsheet.

https://docs.google.com/spreadsheets/d/{some long key here}/edit#gid=0

Spreadsheet KEY

I get the key using Google-apps-script, as described here: Get the spreadsheet key that is in the URL. Not ss.getId()

like image 130
eddyparkinson Avatar answered Oct 14 '22 05:10

eddyparkinson