5

Google Docs allows you to share a document with just the URL. The URL contains a key and authkey to identify the document and authorize access. This allows anonymous access to anyone who has the key.

I would like to access this type of shared document within an application. I've looked at the APIs, and haven't seen anything yet. It seems like this should be possible - since you can access such a document anonymously with a browser, why shouldn't an application be able to access the same document? Anyone know if/how this can be done?

2
  • They've recently added the 'authkey' older spreadsheets dont have them. I now have the same problem. QL reference code.google.com/apis/visualization/documentation/… Commented Mar 28, 2011 at 7:57
  • If you provide an example of the way you're using a non-AuthKey Doc in your application, that would narrow down this question significantly. Commented Apr 3, 2011 at 19:48

3 Answers 3

4

Update for anyone who lands here in 2017+ (as I did). Google seems to have changed the way that share links look. They now look like this when you click get shareable link.

https://docs.google.com/spreadsheets/d/[idwillbehere]/edit#gid=0

You can download the the spreadsheet with this curl command. Make sure the sheet is set so that anyone with the link can access it.

curl -o /path/to/file/you/want/csv/to/go.csv 'https://docs.google.com/spreadsheet/ccc?key=[the-id-of-your-spreadsheet]&output=csv' -L

the -L is the trick here has google often moves the csv around but will send you a redirect link. -L tells curl to follow the redirects until it lands on the file.

Sign up to request clarification or add additional context in comments.

1 Comment

I really wish there was a convenient way of also using that token for allowing per-file access to other applications, especially to enable writing. Does anyone know if that's a "thing"?
2

Some info may help:

When sharing a doc with the link, the URL look like: https://docs.google.com/document/d/xxxxx/edit?hl=en&authkey=yyyyy

To get a copy of the document from curl/wget, use the URL like https://docs.google.com/document/d/xxxxx/export?hl=en&authkey=yyyyy&exportFormat=pdf

See http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#DownloadingDocs for Exporting document.

1 Comment

Thanks for sharing, excellent advice, I got the URL from the Google Docs API. This is now supplanted by the Google Drive API at developers.google.com/drive/manage-downloads
2

You can use a simple URL to access the document, in this format:

https://docs.google.com/feeds/download/<type>/Export?docID=<document_ID>&exportFormat=<format>

Type could be any of these - documents - spreadsheets - drawings - presentations

Format could be any of these

  • html
  • txt
  • rtf
  • doc
  • odt
  • xls
  • ods
  • jpeg
  • png
  • svg
  • ppt

For more details, please refer to the Google Drive API at https://developers.google.com/drive/manage-downloads

Here is an example of a URL to export a Google Presentation as PDF

https://docs.google.com/feeds/download/presentations/Export?docID=15HI6KUtc7dm1jZuk1JY022wxWMcYzz3CiC0dxokokak&exportFormat=pdf

2 Comments

Looks like they may have changed this. Your example doesn't work, and neither does the example I tried.
This (almost) works for me. However, the URL before the question mark should end in '/export' (lower case 'e'), not ' Export'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.