Accessing Google Drive SDK from Perl - google-drive-api

I have couple of Perl scripts that uploads / reads files from Google drive. Is it possible to access Google drive with Perl Api, or I need to switch to python or some scripting languages that Google supports.

We have a REST API. You can use any language to implement your own client, you don't have to use one of the client libraries we support.
An overview of the resources are here: https://developers.google.com/drive/v2/reference
Auth is explained on https://developers.google.com/accounts/docs/OAuth2#webserver
File upload is explained on https://developers.google.com/drive/manage-uploads

I just found a nice cpan module for talking to Google drive. So it might be as useful to you as it will be to me, because I just started playing with it. The only thing that is weird about it is that it needs to run install script to create the initial credentials on your machine.
http://search.cpan.org/~mschilli/Net-Google-Drive-Simple-0.03/lib/Net/Google/Drive/Simple.pm#SYNOPSIS

Related

Google Colab API

Is there a Google Colab API? I'm looking to accomplish things like:
Create users
Create notebooks
Share notebooks with users
Retrieve the contents of a notebook
As pointed out in the other answer, Colab Notebooks are files on your Google Drive. Hence, sharing them or retrieving their contents can be done via the Google Drive API (from what I understand you can use the webContentLink to download it).
However, your first question is:
Where is the Google Colab API?
For anyone coming here from Google trying to find the official Google Colab API (because it's one of the top results when googling for now), here is the answer:
[As of summer 2020] Since this is merely a research project, there is no official API documentation and very limited documentation.
Official Documentation (very limited)
Google Colab: Official FAQ
The Google Colab: Official Feature Demo exemplifies most features. Use it to learn many of its capabilities.
The API in code
Beyond those resources, your best bet would be going to the Official Github Repository. Here are some highlights from the code:
Github: google.colab
Github: google.colab.drive
Github: google.colab.drive.mount (used in quite a few snippets)
Github: google.colab.files (provides download and upload utilities)
Github: google.colab.snippets (add snippets to the snippets list programmatically; FYI: you can find all snippets by going to Insert -> Snippets)
Github: all packages
More Notes
The FAQ explains many important mechanics. Highlights include:
It’s a Jupyter notebook environment that requires no setup to use.
Convinient!
I heartly recommend checking out the Official Feature Demo; it's how I found out that it even supports LaTeX and MathJax! (but then again that might not come as news to someone with experience in Jupyter) 😄
Virtual Machine
The FAQ also mentions...
Code is executed in a virtual machine dedicated to your account. Virtual machines are recycled when idle for a while, and have a maximum lifetime enforced by the system.
That is why you can execute all kinds of the usual system calls (e.g. !pip install, open etc.) and it just works.
However that is also why when you come back the next day...
drive.mount asks for your permission again
you have to re-install all packages
any newly created files are all gone (unless you put em in a drive-mounted folder)
Google Colab Notebooks are just like a normal file in Google Drive.
So, you can use Drive API to manage them just like any Drive files.
For example, you can share notebooks with Drive REST API as documented here
https://developers.google.com/drive/api/v3/manage-sharing

How to retrieve my Install Statistics from the Google Developer's Console

I am trying to programmatically retrieve my company's app data from the Google Developer's Console, specifically the daily installs. I have found that Google recommends the gsutil tool to access the data programmatically through the Google Cloud Storage SDK. However, I beleive they charge for this service. I want a free way to programmatically retrieve the data, preferably as a JSON stream to avoid dealing with file downloads. I have found the "direct reporting" links, but I have problems authenticating when I try to use them, and I also have to do something with the actual files then.
Is there a way to get a JSON version of the data through OAuth2 or something without downloading an Excel file? Has anyone had to do this?
You should look into use the Core Reporting API.
There are client libraries available in a number of languages.
You should work through the Hello Analytics APIs to get started.
Java Script
PHP
Python
Java
A quick solution for building a dashboard would also be the Embed API.
Using the gsutil tool to access the company's storage bucket that are provided by google is a free service. I wrote a code that will run the gsutil code as a process through the command line and parsed the downloaded .csv files into a database for storage. OAuth2 was not necessary.

Adding Google Charts or Similar to Chrome Packaged App

I have a Chrome Packaged App that I want to be able to graph data for the user. I would ideally like to interface with something along the lines of the Charts/Visualization API, but I'm trying to find a solution that will work offline, possibly through integration with other apps or within my app specifically. Is there a way to insert a Google Chart or something very similar into my packaged app? Is there an API or feature I am unaware of that would make this feasible?
Unfortunately the Google Charts library cannot be downloaded for inclusion in a packaged app due to their terms and conditions:
Sorry; our terms of service do not allow you to download and save or host the google.load or google.visualization code.
- Google Charts FAQ
That said, there are many excellent Javascript libraries that are available for download which you could include with your packaged app and use as if they were included from a remote source.
This stack overflow question should help you decide between the various options. You should then download the Javascript files for the library you chose and place them within the folder of your packaged app and then use them like any local Javascript that you've written.

google-drive-sdk : call google-drive-sdk

I am new using google scripts and drive-sdk.
I'd like to call the copy functionality of drive-sdk. When I try it, I get a message that says I need authentication.
Where can I find an example of how can I authenticate from a google script to authenticate de drive-sdk?
Thanks in advance.
Biagio
Have a look at the Google's Drive SDK docs regarding authentication.
https://developers.google.com/drive/quickstart-php is a good example in PHP. other languages they have quickstart examples for: Java, Python, .NET, Ruby, Javascript, Go, and Objective-C/iOS
First, view Google's information on authorising with the Drive API.
Then, choose which language you wish to use, I would reccomend JavaScript (or Node.js) if you want to play around or are making a web app.
If you wish, you can view a simplified explanation of the OAuth2.0 flow.
To clarify, the basic steps you can use to get going in JavaScript (as an example) are:
View this official Google getting started page
Set up the Drive API in the Google Developers Console
Copy the code from the getting started page
Ensure you place your ClientID from the Google Developer console into the copied code
Install Python if you haven't already (version 2 or 3)
Start the web server using Python (python -m SimpleHTTPServer 8000 for version 2) and load 'http://localhost:8000/quickstart.html' into your web browser

How to upload a file from Salesforce to Google drive?

Is it possible to upload a file, pdf or word, from a web application made in Salesforce to a Google drive?
I have downloaded the integration toolkit for Google. I can create the file but I am not able to upload the file.
How should I do this?
You have to integrate your web application with the Drive SDK as described in the docs: https://developers.google.com/drive/apps_overview
I don't know the Salesforce integration toolkit for Google, but there are complete Drive SDK sample apps in different programming languages at https://developers.google.com/drive/examples/index
You can definitely do that. In fact I had done an implementation on the Force.com platform where users could actually upload files to their bucket of space on the Google Drive.
I have started a blog (integration-of-google-drive-into-force-com) just a few days ago and through which I am planning to pass on all my experiments that I would do the Force.com platform to every one around.
I have given a detailed description of the same on my blog. You can visit the same and do approach me for doubts and clarifications.