Wednesday, March 11, 2015
Exporting native Google documents with the Google Drive SDK
Three months ago, we launched Google Drive along with the Google Drive SDK. The SDK allows applications to manage files that users have uploaded to Drive and to integrate deeply in the Google Drive UI. Today, we’ve just extended the SDK to allow developers to interact with native Google Docs types such as Google Spreadsheets, Presentations, Documents, and Drawings.
We now provide an easy way to export native Google documents through the Google Drive API. We also allow native Google documents to be opened directly from within the Google Drive UI using third-party applications.
If your application is already a Drive-installable app, you can enable this feature by checking the Allow users to open files that can be converted to a format that this app can open option in the Google APIs Console under Drive SDK > Import:

When this feature is enabled, your application will show up under the “Open with” menu in the Google Drive Web UI for the file formats you support. Here’s how it works: if your application supports opening one of the possible export formats for the Google document, users will be able to open that Google document with your application. So for instance, if your application is configured to open PDF files, then because Google Documents are exportable to PDF, users will be able to use your application to open those documents as shown below.

When opening a native Google Document with your application from the Google Drive UI, we will pass the following JSON Object in the state
URL parameter of the OAuth 2.0 redirect request that is forwarding the user to your website.
{
"exportIds": ["file_id"],
"action":"open"
}
Then you can use the file ID contained in the JSON object to query the Google Drive API and fetch the file’s metadata. Note that the state
URL parameter is different when opening regular files as we use the JSON attribute exportIds
instead of ids
.
Unlike the metadata of regular files which contain a downloadUrl
attribute which you can use to download the file’s content, the metadata for native Google documents contains a collection of export URLs. These URLs - one for each supported export format - are listed under the attribute exportLinks
, as shown in the HTTP request/response below.
Request:
GET /drive/v2/files/<file_id> HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer <access_token>
Response:
HTTP/1.1 200 OK
Status: 200
...
{
"kind": "drive#file",
"id": "<file_id>",
...
"exportLinks": {
"application/vnd.oasis.opendocument.text": "https://docs.google.com/...",
"application/msword": "https://docs.google.com/...",
"text/html": "https://docs.google.com/...",
"application/rtf": "https://docs.google.com/...",
"text/plain": "https://docs.google.com/...",
"application/pdf": "https://docs.google.com/..."
},
...
}
You can query any of these export URLs using an authorized request to download the Google document in your prefered export format.
Below is the full list of supported export formats -- and their associated MIME types -- for the different types of native Google documents:
Google Documents:
- Text File (TXT) - text/plain
- Portable Document Format (PDF) - application/pdf
- OpenDocument Text Document (ODT) - application/vnd.oasis.opendocument.text
- Microsoft Word (DOC) - application/msword
- Hypertext Markup Language (HTML) - text/html
- Rich Text Format File (RTF) - application/rtf
Google Spreadsheets:
- Portable Document Format (PDF) - application/pdf
- Microsoft Excel Spreadsheet (XLS) - application/vnd.ms-excel
- OpenDocument Spreadsheet (ODS) - application/x-vnd.oasis.opendocument.spreadsheet
Google Presentations:
- Text File (TXT) - text/plain
- Portable Document Format (PDF) - application/pdf
- Microsoft Office Open XML Format Presentation (PPTX) - application/vnd.openxmlformats-officedocument.presentationml.presentation
Google Drawings:
- Scalable Vector Graphics (SVG) - image/svg+xml
- JPEG Images (JPEG) - image/jpeg
- Portable Network Graphics (PNG) - image/png
- Portable Document Format (PDF) - application/pdf
Please check out the Google Drive SDK documentation if you’d like to learn more, and feel free to ask any questions you may have on Stack Overflow.
Nicolas Garnier profile | twitter | events Nicolas Garnier joined Google’s Developer Relations in 2008 and lives in Zurich. He is a Developer Advocate focusing on Google Apps and Web APIs. Before joining Google, Nicolas worked at Airbus and at the French Space Agency where he built web applications for scientific researchers. |
Monday, March 9, 2015
Deprecating SWF exports of presentations in the Google Documents List API
We are announcing the deprecation of SWF export functionality for presentations from the Google Documents List API. We are taking this action due to the limited demand for this feature, and in order to focus engineering efforts on other aspects of the API.
Clients currently making the following request to the API are affected by this change.
https://docs.google.com/feeds/download/presentations/Export?docID=1234&exportFormat=swf
We recommend clients currently using SWF exports switch to PDF exports, using the appropriate exportFormat value.
https://docs.google.com/feeds/download/presentations/Export?docID=1234&exportFormat=pdf
We are disabling SWF exports in the coming weeks. Clients attempting to export presentations as SWF after the exports are disabled will receive an HTTP 400 response.
For more information on exporting presentations, see the Google Documents List API documentation. If you have any questions, feel free to reach out in the forums.
![]() | Vic Fryzel profile | twitter | blog Vic is a Google engineer and open source software developer in the United States. His interests are generally in the artificial intelligence domain, specifically regarding neural networks and machine learning. Hes an amateur robotics and embedded systems engineer, and also maintains a significant interest in the security of software systems and engineering processes behind large software projects. |
Sunday, March 1, 2015
Reflections How to Show a Documents Reading Level in Word!
I truly miss her more than words can say.
A week after finding out that my Grandma passed, I found out that my ex-boyfriend had passed as well. He was only 25. Though he and I grew apart and havent spoken for years, I truly wished only the best for him. He was my first "love" and he has always had a special place in my heart. As much as I was left speechless by my Grandmas death, I am having just as hard of a time finding the words to express my deepest sympathies and regrets for his death as well.
I truly believe that everything happens for a reason, but I can never find or explain the reasons why we have to lose the ones we love. It truly breaks your heart and makes you question the world. Ive honestly felt like nothing has been going right lately. As hard as it is, I keep reminding myself of something my mom told me once:

As hard as it is to cope with lose and to cope with change, I know I am fortunate for the relationships that I have had and that there are so many more who are going through worse. As hard as things are to cope with or manage, we somehow need to put one foot in front of the other and try to move on. To the same idea, I found this other quote on pinterest and I really like it:

The past week and a half, I have spent a good amount of time crying and a lot of time reminiscing. Fortunately Im surrounded by supportive family, friends, neighbors, co-workers and followers who have put up with my distance and my ramblings. So for now, my rambling will cease for the time being and Ill put one foot in front of the other. Perhaps getting myself back on track with my blog and my life will help ease the pain.
This two week long poll had a lot of votes, and the winner was the most recent addition to the poll... how to find out a Microsoft Word documents reading level. This tutorial is actually SUPER EASY!!!

Here are the official poll results...
And here is the incredibly easy tutorial!!!


As for next weeks poll, Ill be adding a blogger tutorial: how to host a linky party!