Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Google Docs and Google Spreadsheet APIs for Android

I am planning on using the Google Documents List, and Google Documents Spreadsheet API's for uploading a database from my app to a spreadsheet online and then editing it.

I just wanted to know if these API's would be the right approach for using Google docs as an online storage space for the data that I have collected in my app.

I was hoping that I could just get feedback from some of you who might have experience with this.

The links for both API's are listed below:

http://code.google.com/apis/documents/

http://code.google.com/apis/spreadsheets/

Thanks in advance!

like image 207
gtdevel Avatar asked Jun 20 '11 08:06

gtdevel


People also ask

Can I use Google Sheets as a API?

The Google Sheets API lets you read, write, and format Google Sheets data with your preferred programming language, including Java, JavaScript, and Python.

Can we use Google Sheet as database for Android app?

Google Sheets is a very advanced form of a spreadsheet, with many out-of-the-box capabilities. Since it is a cloud-based app, you can also use them as a database for your small application or websites.

Can you call a REST API from Google Sheets?

Calling a REST API in Google Sheets is as easy as installing the Apipheny app, then opening the app in your Google Sheet, entering your API request, and clicking “Run”. Keep reading for instructions on how to import REST API data into Google Sheets.

Can I use Google Sheets API for free?

All use of the Google Sheets API is available at no additional cost.


2 Answers

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.

like image 132
ddewaele Avatar answered Nov 15 '22 22:11

ddewaele


(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):

  • Migrating SQL data to a Sheet (code deep dive post)
  • Formatting text using the Sheets API (code deep dive post)
  • Generating slides from spreadsheet data (code deep dive post)

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).

like image 27
wescpy Avatar answered Nov 15 '22 20:11

wescpy