Using Google Docs and Google Spreadsheet APIs for Android

女生的网名这么多〃 提交于 2019-12-02 19:42:14

(Dec 2016-Feb 2017) Various parts of this question are now out-of-date as: 1) GData APIs (including both the Documents List and Spreadsheets APIs) are the previous generation of Google APIs. While not all GData APIs have been deprecated, all modern Google APIs do not use the Google Data protocol; 2) the Google Documents List API has been replaced (and shut down in 2015) by the Google Drive API (mobile developers have a specific Google Drive Android API), 3) Google released a new Google Sheets API v4 (not GData) in 2016, and 4) Android Studio is now the preferred IDE over Eclipse.

In order to use Google APIs, you need to get the Google APIs Client Library for Android (or for more general Java, the Google APIs Client Library for Java). Now for some examples... here's the Android quickstart code sample as well as the more general Java Quickstart code sample for the Sheets API. Can't hurt to pass along the JavaDocs reference for the Sheets API either.

If you're not "allergic" to Python, I've also made several videos with more "real-world" examples using the Sheets API (non-mobile though):

The latest API provides features not available in older releases, namely giving developers programmatic document-oriented access to a Sheet as if you were using the user interface (create frozen rows, perform cell formatting, resizing rows/columns, adding pivot tables, creating charts, etc.) However, to perform file-level access such as imports & exports, you would use the Google Drive API instead -- for mobile, there's a specific Google Drive Android API.

But based on your use-case, I don't believe you need the Drive API (nor the deprecated Documents List API) unless you need to perform file operations like searching or those I described just above. You can just use the Sheets API to "upload a database from your [Android] app to a spreadsheet online and then edit it." My one video above on "migrating SQL data to a Sheet" should give you enough pseudocode (that's what Python is, isn't it?) to write your app.

To learn more about how to use Google APIs, check out the variety of Google developer videos (series 1 and series 2) I'm producing (heads-up mostly Python or JavaScript).

For accessing Google APIs on the android platform, the Google APIs Client Library for Java is the way to go.

It includes sample apps for the Documents and Spreadsheet APIs.

user1299359

Personally I don't like Google's api lib for java. I honestly think you are better off using scribe and jackson to deserialize the feeds. We made a hello world. It includes calls with openid and oauth to spreadsheet feeds and deserialization template. Hope it helps.

link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!