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 :)
I haven't seen your code, but most certainly the issue is that you're using ClientLogin, and are authenticated for the Documents List API using the 'writely' service. However, since exporting a spreadsheet will hit spreadsheets.google.com, you'll need to use ClientLogin to authenticate against the 'wise' service. From Java, that means using the Spreadsheets Java client library, which is documented here: http://code.google.com/apis/documents/docs/3.0/developers_guide_java.html#DownloadingSpreadsheets
Note the note labeled 'Important' at the top there, which links here: http://code.google.com/apis/documents/docs/3.0/developers_guide_java.html#DownloadingSpreadsheetsClientLogin
At that link, using a SpreadsheetClient instance is detailed.
Good luck :)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With