As far as I know there's no way for server-side application to be notified by Google Drive that some file has been updated or uploaded.
But it seems the WappWolf somehow gets it, via some API - how it does that? ( see introduction video http://wappwolf.com/gdriveautomator )
There is no way to currently get notifications from Google Drive. The best way is to poll the changes feed of the Documents List API to see if a user's Drive files have changed, which files have changed, and to act upon those changes accordingly.
There is a way, to get notification from GoogleDrive, only when in Spreadsheet Format.
But it's a good start.
In the spreadsheet, go to Tools > Notification Rule. Here, set the rule that will notify your email when any changes is made to the form + data + spreadsheet,(whatever we called it).
From this starting point, you may define how you are going to be notified. For me, the simplest would be gmail apps notification within my android phone. The sky's truly the limit.
Related
I am looking to find out if it is POSSIBLE to restrict EDITORS from downloading, copying or printing a Google sheet or other documents in a Google Drive. We share sheets/documents with our customers so they can fill in the details. For that we need to make them EDITORS (so they can edit and even invite others to the party). I know that we can restrict COMMENTERS and VIEWERS from downloading, but in our case we need to prevent EDITORS.
We have a LOT of intellectual property in our sheets (custom formulas and approaches), and we would like to be able to prevent people from simply downloading it. As I understand it this SHOULD be possible using the Google Drive API, but I have not been able to figure out how to do it, yet. Looking at the API it obliquely says it MAY be possible, but it is not clear :-(
Direction, or sample code, would be VERY much appreciated.
TIA
It's not possible to restrict editors from downloading files. The documentation mentions that only commenters and viewers can be prevented from this. Then in the API docs concerning permissions and their definitions you will see that there's nothing controlling downloads either. This is just a UI change.
If you think about it, the reason is clear: Even if you manage to stop direct downloads, to anyone with at least read access to the file or API this is just a minor inconvenience. They can still read all the content and metadata from the API and replicate the file perfectly. Even viewers with copy disabled can still read the formulas from the formula bar. Sharing the Sheets file is inherently unsafe if you have confidential data in it, since a determined attacker can still get all your trade secrets easily. You're only supposed to share these files with trusted users.
My suggestion is to take a different approach. Do not share the Sheets file at all and use something else as intermediary to request data from your customers. For example:
Create a Google Form to save the responses to a Sheet. Your customers will only need to fill out the form and the sheet will be filled with data that you can handle on your side.
If you need the users to also view some information in the Sheet before filling out their info you can build an Apps Script Web App that displays only the plain data that you need to show them. With this you can hide the formulas and other sensitive information. Using templates and server functions you can allow the users to interface with the Sheet data similarly to how they do it now, but with a more restricted view. You could even allow them to edit only the data you want them to. This requires more work and is starting to delve into web development, but It's much easier than a fully fledged website since the hosting and interfacing with APIs is handled by Apps Script.
You could just create your own application and use the Sheets API to read and write data from the Sheet. This is pretty much the previous suggestion but much harder, though in the end it will give you more flexibility.
The bottom line is that sharing your Sheet in any way is akin to giving your users full database read or write access, and there's no single setting that can prevent that. Your best bet is to avoid sharing these files and use a different method to request user data.
Our app would like to receive notifications when changes have been made to anything on a user's drive. We are using the watch endpoint to do this, authorized with the broadest drive scope:
https://www.googleapis.com/drive/v2/changes/watch
However, only changes with a X-Goog-Resource-State of 'change` seem to be ever delivered. There are no notifications when adding or removing files. This seems erroneous, as when I query https://www.googleapis.com/drive/v2/changes, those add/remove changes are indeed in the returned list.
I switched to Drive API v3, which seems to have resolved the problem. I am receiving add/remove notifications now.
I'm new to the Google APIs, and would like to write a small service class for my web application that:
creates blank Google document without user assistance
assigns a generated title
returns a URL that can be provided to multiple people to edit this document
This document mst be editable via a sharing link. Ideally it is owned/managed as part of the web service's Drive storage.
Code is welcome if it's easier than explaining, but I'm really asking for help understanding Google's service offering.
Can I fully authenticate using only credentials specific to my app? (e.g. call the Drive API without prompting an interloper/observer/user to
authenticate.)
Once authenticated, can I create documents local to my
API?
Whose quota are the created documents consuming, the person that created the API key?
Can I share
these created documents with others?
Will I be able to manage a list of
these created file URLs from a standard Google web UI?
Just to clarify what it is that you are asking. You want to be able to embed a google doc on your website A couple things that can happen here.
First, you will need to create a google doc, lets say a spreadsheet. Within that spreadsheet you will:
click File > Publish to the Web.
From here a new window will be brought up. Click Embed and Published content and settings and click the publish button. Ensure the Automatically republish when changes are made checkbox. (this will allow for your website to be automatically updated anytime that doc is changed.
Take the embedded link that is generated and plop it in your webpage and it will be live.
Now you can share the page via Google Docs and anyone that has that link can make changes to that spreadsheet. As soon as a change is made, it will update on your website with the next refresh.
Hope this is all clear, let me know if there is anything unclear.
Cheers
Is it possible to get a real-time notification (without extensive polling) for changes made to a Google document (document / spreadsheet / presentation)? If so, what is the model structure (if that makes sense)? Any pointers to documentation or samples would help!
The documentation at https://developers.google.com/drive/manage-changes gives an API call that returns instantly and tells you whether there have been any changes since the last one. However, this is useless you want to know almost as soon as a change has been made -- you would have to make back to back API calls every second or sooner and churn a lot of resources. The Drive Real-time API in contrast gives a way to be instantly notified of any changes without extensive and frequent polling. It does this with an HTTP call that "hangs" until there is a change ready (or a timer expires). This is a classic long-poll technique.
My question is whether such a facility exists for Google Documents / Spreadsheets / Presentations. Or is it available only for custom app-specific files other than these standard ones. If it is not available, are there any plans for making them available?
Thanks in advance!
In my knowledge - the answer is "NO". I have tried this before and could only do it with the timed polling. The API is limited to tell you only when you ask, not when something happens.
I thought of a code that is embed into document and does a self broadcast to a specific URL or some listener. My experiments were with Google App Scripts. Detail idea is to create a custom function that gets triggered on the 'Save' event. But I could go no further as there is nothing enough in documentation as per me to achieve this specific goal.
On the timelines for this availability, there are questions in the scripts forum on this, but none replied on these lines.
It looks like it, see https://developers.google.com/drive/v2/reference/changes
it has examples too
edit:
https://developers.google.com/drive/manage-changes
more info about tracking changes
The answer, I'm afraid, is no. There is currently no way for you to be notified by email when a change is made to a Drive text document. This function is available for spreadsheets, but not for text files. If your document is public, you ccan subscribe to its RSS feed to view changes, or use the Tools -> Revision History function in Drive.
There is one downloadable program, googledocsnotifier --information--, which emails you when edits are made and allows you to open the doc that was edited, but it appears that it only works when you are online. You can download it here.
Hope this helps!
We're working on an app to sell our music and was wondering if Google Drive can be used as an online storage solution.
The user would complete the transaction on our site, and then authorize us to save the file (or multiple files) to their Google Drive.
The appeal to us is to solve downloading problems via the browser. I believe the Google Drive api returns a successful response when the delivery is complete. If incomplete, we would then either resend or update.
One other requirement is whether we can set permissions to not allow sharing after save (and for that setting to be permanent).
You can do everything you want. The last part about not allowing users to reshare, you can do this if you still own the file, but cannot do it if you have made the user own the file. I am not sure you could ever achieve that - a user can always download a file and share it themselves, whether you are using Drive or your own custom system.