Are there any plans to open this extremely useful API to tools outside of App Script?
We love App Script, but need this access from other systems.
Not yet but this is something we are actively looking into. In the mean time unfortunately you are stuck with Apps Script or you can upload a file format that we can convert to a Google Document for instance an ODTor an RTF file and upload them to Drive via the API with the convert URL parameter to true. See: https://developers.google.com/drive/v2/reference/files/insert#convert
Related
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.
Using js file picker to select PDF files from Google Drive.
I'm encountering an instance when the downloadUrl is undefined.
I don't understand what can cause this.
I know downloadUrl can be empty for native Google formats, but these are PDF files.
I'd like to know what scenarios (except native Google formats) can cause an empty downloadUrl.
Thanks
You should use the Drive API to fetch the picked files' metadata in order to retrieve the downloadUrl. https://developers.google.com/drive/v2/reference/files/get
Native Google formats can be downloaded (converted and downloaded) via their exportLinks: https://developers.google.com/drive/v2/reference/files#exportLinks
The response I was receiving was 403.
And the scenario was user accessing "work" Drive (Google Drive for your domain)
Turns out Google Drive for your domain Administrators can restrict the permission to install third party apps.
https://support.google.com/a/answer/6105699?hl=en
User will still be able to allow access for the app and select files. Its just going to fail every time with a 403. Very confusing UX.
I have a webapp, mywebapp.com, that successfully gets user permission to access Google Drive, mostly following examples for server-side flow here:
https://developers.google.com/drive/web/auth/web-server
I successfully upload, then access those SAME files.
However, what I really want to do is access OTHER files, in particular Google Docs docs. Can this be done, and how?
If not, can it be done with client-side flow using regular JavaScript (not Google's hosted scripts)?
What your app can and cannot see is determined by the scope. The possible values are enumerated here https://developers.google.com/drive/web/scopes
I've succeeded in using the filesystem API in a Chrome App on my Chromebook. But none of the examples I've found allow you to open files from Google Drive. Any number of apps on the Chromebook (supplied or added) open the exact same dialog but with Google Drive showing on the left along with Download and External Drive.
Is there a simple example App which shows how this is done?
Or am I simply missing some concept which will make even the Diff or TextEdit examples work this way if done (like pushing the App to the store, perhaps -- right now I'm just loading and packing my own off local storage)?
From reading your comment it seems that you will want to use google drive sdk in order to integrate the 'open file' dialog into your web app.
and even more to the point - the file 'picker' - In order to integrate the file picker you will need to use google JS client lib. Then you will be able to open the file dialog with a code like this:
// Use the Google Loader script to load the google.picker script.
google.setOnLoadCallback(createPicker);
google.load('picker', '1');
// Create and render a Picker object for searching images.
function createPicker() {
var picker = new google.picker.PickerBuilder().
addView(google.picker.ViewId.IMAGE_SEARCH).
setCallback(pickerCallback).
build();
picker.setVisible(true);
}
Good luck.
The answer to this is to use the <input type="file" name="somename" size="chars"> code in the browser. That is what is producing this. It creates a standard way to read in the file from disk or Google drive. It's what I've seen in multiple apps. All the API stuff is a red herring, if what one wants is to get access to this simple dialog.
However, it doesn't allow me to WRITE, just to read, since one would expect it to be returning only the content of the file, not a file handle of any sort, or even the full name. I'll play with it and figure out whether there's any hook I can find to tell me to write it to Google drive (using the links Ido provided above). If anyone has suggestions on where to snag the full path (or an interesting Google Drive path) somewhere using this, I'll love to hear them.
If you remember, I'm trying to integrate Google Drive within our website, which is built on Elgg. Elgg already has its native file management system.
What we would like to do is to copy a file from Drive to our server, you know, kind of : Send to My Files. The problem is that I don't see any URL in the file metadata indicating where the file is physically stored.
I can see the copy function in Google Drive SDK but I don't think it allows to copy the file on our own server. Unless I've read it wrong.
Can you help me?
Thanks you.
If you are trying to save a file that has content stored in drive (e.g an image, pdf, etc.), the file's metadata should contain a downloadUrl that can be used to retrieve the file's content through an authorized GET request.
For Google Documents (Google Docs, Google Spreadsheets, etc.), the data is stored in a private format that cannot be understand by third party applications. In this case, your app will have to use one of the exposed exportLinks to export the document into a format understood by your application.