Create shared Google Drive document owned by web service - google-drive-api

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

Related

Is it possible to view the GAS code published as an application from outside?

I'm trying to publish a project created with Google Apps Script as an application.
I'm planning to make it accessible to anyone so that people who don't have a Google account can use it.
So my question is, is there any way to view the source code of a published application from the outside?
I'm worried about security because the code contains information that I don't want to show to the outside world, such as API keys.

How to make starting a UiApp by a group of users easy?

After opening Gmail or Google Drive you see the google bar (containing the Google logo, a searchbox and clickable button for apps, notification of unread messages, sharing and about) on top of the window.
I want to put a put a button for starting my UiApp (build with GAS) there as well.
Is this possible (and how) ?
Several users will have read access to the google drive. I want those users to be able to start my UiApp from a button in google bar as well. What should I do (and what should they do) to make that possible?
If this is not possible, where can I put my UiApp best so users can start it easy?
My application is NOT intended to be accessible by other people except the ones I provided access to my Google Drive.
I believe you can accomplish this by leveraging the Gadgets section of the Gmail API to accomplish this as detailed here. I've seen this type of Gadget added by a Chrome Extension before but not directly from Google Apps Script.
I think you would need to use the "New" button, and publish a script to the Chrome Web Store. Then your app would be in the drop down list of the "New" button. The problem with that, is that the general public could see the app. I'm assuming you don't want that.
If you want an easily accessible central location for users, you could create a website with Google App Engine. You can get a free domain name of
www.mySiteName.appspot.com
It would be easier for users to get there than the URL of your Apps Script.

Google Doc API Single Login

Here is what I am trying to do:
Create an application which can pull down a single predefined Google Document.
Desired approach:
Create an app which automatically logs into Google Drive with the document owners account.
Once logged in the latest version of the document will be downloaded and presented to the user through the app.
This approach means that App users can access the document without a Google account.
What I don't want:
I don't want users to have to login to Google Drive themselves. I want people to be able to access the document automatically through the app.
I don't want the document to be public.
The problem I have hit:
All login approaches I can find within the Google documentation require the user to login through their Google Accounts - OAuth style for example. I can't find anyway of just hard coding the login for the single account owner into the application.
Other notes
I am creating this as a web app in PHP.
Any help or different approach suggestions gratefully received. Thanks

Generate a URL for Google Drive publicly shared files and access them

I have a collection of PDF files on a Google Drive. I have shared them and I want to be able to link to them from a list on a web site. What I'd like to be able to do is work out the file name of the PDF using information in the list. As a simple example, if my list contains items 1, 2 and 3 I'd like to be able to upload PDF files 1.PDF 2.PDF and 3.PDF to Google Drive then have the web site just link to those when a link is clicked and show the PDF files in the browser.
So, I guess I could do this just by uploading the PDF to Google Drive and manually adding a link to PDF on the web site. However, what I want to do is generate the link programmatically so that when I have, say, 50 PDF files I don't have to keep getting the link from Google Drive and adding it to the web site. The site should just work out that item 50, say, in the list will link to 50.PDF, for example.
I've tried to get the file id using the API but that requires the authorization token to be generated and manual intervention to take place, so that won't work. At least, not at the point where the file is viewed because the viewer is anonymous.
So my questions are:
Is it possible to work out what a file name will be on the drive using just something like an item number in a list?
I guess that there are maybe some other options - for example, when I add the items to the list on the web site programmatically, I could go and locate the google drive file manually using a web application and link it using the file id at that point. I could store the ID in a database - however, would any anonymous user then be able to just click on the file link on the web site and view the file?
Finally, can anyone think of another way to do this?
Any help would be appreciated! :)
Is it possible for you to use a service account? You can authorize the app with an account dedicated to your app and user doesn't need to authorize and authenticate. The files you will be uploading will be managed under the service account's Drive.
You can learn more about service accounts on https://developers.google.com/accounts/docs/OAuth2ServiceAccount
If you have implementation specific questions, please ask.

Integrating Google Docs - Authentication and Access

I'm interested in integrating Google Docs with our application, and curious if the API will support our use case.
Our user would see a link on our site to open a document (document created programmatically). When they click the link, it would open up Google Docs (in another browser tab) in either write or read-only mode depending on permission in our system. Preferably the user wouldn't need a Google account at all. Also, before they click the link we would like to show a completely static HTML representation of a particular revision of that document. It would be also nice to listen to changes (from our back-end) to documents to update say the static html or some such. They wouldn't be able to create new documents, or delete the document.
In Summary:
Control document create/deletion
Control document sharing (some workaround may be acceptable here)
Authenticate thru our service to edit/view doc
Add comments to document thru API
Turn document into static HTML
It might be nice to customize the Google Doc editor to make it more geared for the type documents we create (film scripts), but not required, a template is helpful, so creating a doc with a template would be nice.
Which API's, account types, etc do we need to accomplish the above if possible?
A Google account is required to interact with Google Drive and Google Docs. What you could do is, upon clicking, authorize access to the user's Google Drive account, copy a doc into their Drive, and then redirect them into editing the newly copied doc. All of your other requirements are supported.
You can do these things with the Google Drive SDK.