Search code examples
javaandroidgoogle-api-java-clientgoogle-drive-android-apigoogle-sheets-api

Downloading Google Sheets spreadsheets from Google Drive on Android


I am working on an Android app that uses the gdata-java-client to download documents for display only. So far I have an application that authenticates with the services and displays a list of user documents. When the user selects a document another query is made for the documents itself. A request for txt, html, rtf and doc files works well, however when I request a spreadsheet in either .csv or .xsl format the result is unexpected.

I'm using an HTTPResponse object to store the result of a an HTTPRequest. When I request a document in .csv or .xsl format the HTTPResponse.parseAsString() method produces an entire html page which appears to be the Google Docs home page. Sounds strange, but the result is the actual html for the login page. The HTTPResponse.getStatusMessage returns a 200.

Seems like I am missing something simple here. Is there another property of the HTTPResponse that contains the .csv data?

I am pretty sure that I am using the correct uri for downloading spreadsheets because it works when I download through my browser. In any case here is an example uri:

https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=0AsE_6_YIr797dHBTUWlHMUFXeTV4ZzJlUGxWRnJXanc&exportFormat=csv

Thanks in advance for any help :)


Solution

  • I am not familiar enough with the Documents List API to know, but from your description it sounds like you may have encountered a bug in the Documents List API, and it sounds to me like an important problem to fix.

    Please report your issue at the Documents List API forum to increase the chance that someone knowledgeable would be able to look into this issue:

    http://www.google.com/support/forum/p/apps-apis/label?lid=5c316c702e844c99&hl=en