Accessing and manipulating Google Sheets in iOS - ios

I'm attempting to use Google Sheets as a back-end for an iOS app. The spreadsheets in question are private, so will require Oauth 2.0 for interactions.
So far I have come across three different ways to access spreadsheet data, but I'm not sure which one is the right one.
GData library
Google API Client
Google Apps Script
Has anyone here found success with any of these options, and if so how?

Rather than any of the options you've listed, you should be looking at the
Apps Script Execution API, which is a supported component of the Google Apps Script environment. It was introduced just over a month ago, in response to the growing demand for ubiquitous access to Google Apps.
As for the "how" - the Quick Start should get you started.

Related

Google Docs API, new "Compare documents" feature available through API?

Google has rolled out a useful tool of compare docs.
https://9to5google.com/2019/06/11/google-docs-compare-documents/
I need to access through an API because I'm comparing many documents. I searched through the API reference but didn't find it. Did i just miss it or is it not available?
Answer:
This feature is not available via the Docs API.
More Information
Fundamentally, the Google Docs API lets you create and modify documents.
From the documentation:
The API allows you to do tasks such as the following:
Automate processes
Create documentation in bulk
Generate invoices or contracts
It is not an API which has methods that directly replicate the methods available in the user interface.
Workaround:
The Revisions resource of the Drive API might be an approximate solution for you, as it allows revisions of documents to be accessed and downloaded via export links.
As Google Documents have some level of version control implementation, it might be possible to use this to make document comparisons. Unfortunately however, there is no direct way of comparing changes, and as per a recent Issue Tracker case it seems that due to the zip nature of .docx files, not even exporting and comparing MD5s can be a direct solution for this.
Feature Request:
You can however let Google know that this is a feature that is important for the Docs or Drive API and that you would like to request they implement it. You can use the aforelinked Google's Issue Tracker to report issues and make feature requests for their development services.
The page to file a Feature Request for the Google Docs API is here and the Google Drive API is here
References:
Introduction | Google Docs API | Google Developers
Revisions | Google Drive API | Google Developers
Issue Tracker Links:
Google Docs export returns non-stable (i.e. different) bytes content for each ex
Docs API Feature Request | New Issue - Issue Tracker
Drive API Feature Request | New Issue - Issue Tracker

does google provide a wsdl or wadl

Currently was playing around with a robotic process application called Blue Prism and learned you can drop a URL link to a WSDL location to consume api calls. I tested using a free service and it worked great.
My question is in regards to Google Sheets API, a project has come up where this would be very usefull however I'm not able to locate or if one even exists (A WSDL or WADL) for the google sheets api.
If anyone could give me any direction on this that would be fantastic.
Google docs can be automated using REST web services. You can find more information about google docs api at google sheets API page.
BluePrism has an out-of-box tools to work with SOAP request with WSDL, but unfortunately it does not have out-of-box support for REST web services.
If you'd like to use API to interact with google docs, then you can do that, but you'll have to create your own code stages to do that.

Pushing data from iOS to Google Cloud BigQuery

I am new to Google Cloud Platforms and not quite sure with the whole architecture but what I am trying to achieve is to save some data to Google Cloud from an iOS application and do some analytics work on this data using Google Cloud Products, such as: Dataproc and Datalab. From what I read so far I would need to create a dataset in Google Cloud BigQuery and create a table in it. I have done this using the Google Cloud Web UI but now I want to populate the table from my iOS app. I can't seem to find how to do that.
The most painless route would be to wire up Firebase Analytics and then turn on its daily log export to Big Query, as described by Google in the walkthrough Importing Firebase Analytics Data into BigQuery. Google maintains the entire analytic export stack for you then, seeing as they also maintain Firebase. The downside is that the analytics export happens only daily.
Alternatively, you'd be looking at using the Big Query REST API to upload data, as documented by Google in their Loading Data with a POST Request how-to guide. The iOS tooling for that would be your usual NSURLSession and NSURLDataTask APIs, or whatever abstraction you prefer that's built atop them.
Google does maintain a collection of iOS-native APIs, but unfortunately, Big Query is not included amongst the supported APIs as of May 2017. There are native Big Query clients for Go, C#, and Java, amongst others. So you could use your own API for upload to a server you control, and then use one of those client APIs serverside to implement the actual Big Query integration, if you wished.

Can we use Google Spreadsheet as a backend database

I am trying to develop an application, where I where fetching data from multiple clients related to some transactions. Now I want to make some analysis using the Google Spreadsheet. Is there any way by which I can achieve this using the ASP.Net MVC(using C#). Google provides OAuth and When I implement the code and when I am trying to send the data to Google spreadsheet which I receive form the clients. However, when I am doing that, for every new client, Google asks for login credential. Client enter their own credentials, and the Google sheet instead a common sheet, client own sheet is used. Thus, my purpose is not solved. Is there any way possible to do this. I does not seem to find proper documentation on Google as well. Please provide some suggestions to implement this. Thanks in advance.
This can be done very easily if you just want a read only database.
You must publish your Google Sheet to the web and, from its url, copy its id.
For example my sheet has this url: https://docs.google.com/spreadsheets/d/1IHF0mSHs1HdYpIlIzYKG3O8SnAhKU_a6nEJSz04Togk/edit
The long alphanumeric string in the middle is my sheet id. Copy it and place it instead of XXXX in the following url, as follows:
https://spreadsheets.google.com/feeds/list/XXXX/1/public/basic?alt=json"
So the final url would look like this:
https://spreadsheets.google.com/feeds/list/1IHF0mSHs1HdYpIlIzYKG3O8SnAhKU_a6nEJSz04Togk/1/public/basic?alt=json
Then you can simply access this url and get all your data as json.
Using jQuery:
var $url = 'https://spreadsheets.google.com/feeds/list/1IHF0mSHs1HdYpIlIzYKG3O8SnAhKU_a6nEJSz04Togk/1/public/basic?alt=json';
$.getJSON($url,function(data){
alert(JSON.stringify(data.feed.entry));
});
You will get a long json structure. The relevant data is in data.feed.entry. There you'll have many entries. On each one you'll have a "content" property and within it, a "$t" one. These will give you all the cells.
So for getting the first row, you will have to get data.feed.entry[0].content.$t.
Hope it helps.
This can be accomplished using Google Apps Script. In particular, you can achieve this with a "bound" script in Google Sheets (i.e. a script that was created in the context of the sheet that you wish to create as the "backend") that you then publish as a "web app" script. When you publish it, you can make it execute with the authority of the owner of the spread sheet (rather than the authority of the user who invokes the url), which will not require the end user to explicitly authorize themselves (since it is the script publisher's credentials, not the user's credentials, that are being used).
It should be noted that, while this (and generally building on top of Google Apps Script) is a reasonable approach for small-to-medium apps, you'll probably find using Google Cloud Platform (and, in this particular case, the Cloud Datastore) as the better, more scalable solution for small-to-large apps. That is, if you are prototyping or creating an internal tool that is unlikely to catch fire overnight, I'd go with whichever approach you find more convenient / simpler; if you are creating an app that could potentially experience a "success disaster", I'd go with Cloud Platform, instead.
If your sheet is public, you can do it withouth authentication. You can use google API Visualization with the query language or use the Google Sheets API.
But if your sheet is private, it is mandatory the use of OAuth2 authentication through service account credentials.
In order to do that, you have to create a service account (with owner of the project role for example). Then you have to download the client_secret.json file which will be the one you use in your code.
Finally you have to share your spreadsheet with the email you get in this file. Look in the file and you will see it.
I have made a tutorial. You can visit at http://edba.xyz/google-sheets-as-database. It is mainly based in PHP but it is easily trasportable to
other languages.
I have recently been developing a website using google sheet as backend. It is great. The speed is also appreciable.
I have integrated the custom backend which I wrote on google apps script with my Django app. So now my website stores the user information on google sheets. The google sheet code and Django app interact via Rest API which can be easily developed using doGet() and doPost() in apps script and python request on the Django side. Once the necessary structure is built( it does take some time tweaking if you are new) but then it works as a great database for your website.
Google spreadsheet is a great solution for quick prototyping database and even in some cases for production use.
People have already realized the potential and there are many tools today for turning your Google spreadsheet into a backend api
There are couple of libraries such as node-sheets for obtaining a json feed from a Google spreadsheet (read-only)
Also, if you need a complete standalone service you have some paid options like
https://sheetsu.com
And also open source options such as
https://github.com/scheduleonce/express-sheets
This can be installed on any cloud provider via Docker and you can point it to your spreadsheet and it will dynamically turn it into an api.
So if, for example, your spreadsheet has the following sheets:
| articles | products | users |
It will automatically create the 3 endpoints
GET /articles
GET /products
GET /users
It is suitable for read-only apis (you update the spreadsheet directly, not through code) that don't need to be changed too often (although you can control the update interval)
You can use Kodem.io.
Google Sheets As Backend allows you to do CRUD requets using Google Sheets.
Disclaimer: I work at Kodem

Examples using updated gdata-java-client with Oauth2?

According to http://code.google.com/p/gdata-java-client/source/detail?r=505 the gdata-java-client library has recently (April 2012) been updated with OAuth2.0 support. I'd love to use that in a web application, to create and modify google spreadsheets. I want users of my web app to have their data stored in a google spreadsheet under their own credentials.
I'm new to using google apis, and am getting quite lost while trying to wade through examples. They all seem to refer to deprecated auth methods (oauth1 or authsub or clientlogin).
Has anyone seen any good, recent samples on how to use gdata apis with Oauth2.0 to accomplish the sort of thing I'm talking about? Thanks very much in advance. And sorry if the question is too n00by.

Resources