Use Google Drive as an external editor - editor

I have a website that stores, parses and display .docx files. I want to give users a way to edit those files.
I don't want to embed a third-party widget in my website and I thought that I could use Google Drive API. My idea is that I can give user a button “Edit in Google Drive” which back to my server somehow.
The problem is that I haven't found neither API function that allows to do that nor examples of such approach.
Am I on the right way? Can my idea work? If yes, then how can I do it?

Look at the drive api. There is one to upload a new file and optionally convert it to native google format.
To upload it, read about using oauth2 to authorize storing it on the user's drive. User must have Drive of course.
After the user finishes editing, they press a button or something on your site so you use the drive api to either read the gdoc and convert yourself to docx or use the drive api to download as docx.
Both uses of drive api are explained in the docs.

Related

Loop through PDFs in Google Drive, display on Rails site

I have a client storing PDFs in a public Google Drive folder. I would like to loop through that folder and display a clickable link (i.e. filename) on my Rails web page. I'm reading through the Google Drive API information here:
https://developers.google.com/drive/api/v3/about-sdk
Can anyone recommend additional methods or tutorials that might be useful for a rails app?
Alternatively, would it be better to use Amazon S3 and Paperclip EDIT. 5/25/18 Paperclip is deprecated. Active Storage has been recommended for file upload for file upload and storage? (Not sure I want to go this route. I think my client wants to create his file in Drive and voila! It appears on his web page. Just not sure that's possible.)
Newbie programmer here. Thanks.
To get a list of files from a Google Drive folder you'll need to use the Files:list method from the Drive API
In the Files:list page I generally find it useful to use the "Try this API" to get sample responses from the Google API.
To list all the files for a given Folder ID you'll want to use the following syntax for the q parameter:
'<folder_id_here>' in parents
For example:
'1Cz3KdJlzMj-vmN6OMd_nQyUKWlkdsfujo' in parents
For Ruby example specific to the Drive API, see:
https://developers.google.com/drive/api/v3/folder
For complete Ruby examples, maybe check out the following:
https://github.com/google/google-api-ruby-client-samples

How to print documents and spreedsheets from google drive

I can't seem to find information on how to print files through google app script.
I found an answer in this website but it doesn't work, I think it's because it's 3 years old and google script has had some changes.
google app script print button
You can't print directly from GAS (I've searched far and wide), as described in the post that you linked. However it is possible to create a downloadable document with the desired content and then pass that blob off to the client for downloading (depending on wether you're still working in GAS or a web app environment).
Personally, I felt that it was a headache to deal with how each browser deals with downloading blobs. Therefore I usually go one of these two routes: provide a public downloadable link from the drive of the owner of the script and then push it to the user to download, OR just email the document to the user and let their email client handle downloading the blob.
Alternatively, if this is an add-on, you can make it so that the document is downloaded directly to the users own drive and just inform them where the document will be located.

Uploading pdf files stored in iphone to server in ios

I am making an iphone application which is pretty much like forum. People can ask question and upload a pdf/doc file along with the question. Is there a way to access the pdf/doc file in iphone when user clicks upload button and send the file to server?
I have implemented the feature for image for which I used UIImagePicker to pick the image and send it to the server with http request. But I am completely lost and have no idea how to handle pdf/doc files in same manner.
Any help/suggestion really appreciated. Thanks in advance.
If you want to upload PDF and Doc files, then you can integrate Dropbox and Google Drive in your app and then select the files ,as Apple does not have centralised storage. If you notice Apple also chooses the documents from Google Drive while composing a mail.
So implementing and integrating google drive and Dropbox would be a good option.
Here is the link for Dropbox https://www.dropbox.com/developers-v1/core/sdks/ios
Here is the link for Google Drive https://developers.google.com/drive/ios/quickstart
Implementing Google drive is a bit hard but dropbox is quite simple.
Wish it saves your time. All the best!
I think you are looking for a combination of two things (both have been discussed here before and I include the links below).
(1) store a PDF. There are many options but the best way is to allow coredata to save outside the persistent store. Then store the reference to the file in core date. See: Insert a PDF file into Core Data?
(2) send the file to the server. There are many options for this as well. The fastest is probably to use a wrapper library such as ASIHTTPRequest. See: File Upload to HTTP server in iphone programming

Authorize just one spreadsheet in the Google Spreadsheet API

I'm working on some .Net code to collect some data on a server and put it in a Google Spreadsheet. The job needs to run once a day, clear out the sheet and repopulate it. I have all that working, but I can't get the authorization right. I can do it with my personal Google credentials, and I can get it to work with OAUTH by allowing the app to manipulate all my spreadsheets using the https://spreadsheets.google.com/feeds scope. But, what I really want to do is allow my script to read and write just one sheet. Is that possible, and how would I do that?
You are using very old scopes. Look at the drive.file scope
https://developers.google.com/drive/web/scopes
Its not possible using the spreadsheets API. That api is very old and doesnt have a scope for indivdual files.
it might be possible by creating a spreadsheet using the drive API by uploading a CSV with conversion, but you will need permission to create new drive files and that also means permission to the entire drive.
Workaround: Create a new google account and share the spreadsheet with it. Do the OAuth using the new account.
#Zig Mandel is right - the API (Gdata style) wants access to all spreadsheets. But you can workaround the problem using a new account.

Integrating Google Docs API

I'm just beginning with programming, but i wanted to know if it's possible to use google docs api to make documents on another site using the google docs text editor?
Is there some sort of way i can put the google docs text editor onto a website so that we can use that for document creation instead of tiny mce?
Basically the functionality needed would be documents created, openly shared, a postable version of it (take html code) -- so it can go on the document display page, and
Of course there would be google login and everything, but i just wanted to see if this would work.
No, that is not possible, sorry.

Resources