Generate a google doc via Java - google-drive-api

I've been swimming through searches and tutorials and guides and references for days, and I can't seem to find a good way to generate google docs via Java.
I can generate/import .txt files as regular google doc files successfully with java using the drive api, but that's only text files; I need to at least include unordered lists and links in the doc for it to be useful.
My next attempt would be to generate a .rtf or a .doc and then try to import that into google docs, but before I embark on such a project, I wanted to ask you guys first. I also see the realtime api, but it looks like it doesn't specifically deal with docs, just arbitrary data.
What's the recommended way to upload a new google doc with lists and links and stuff?
Thanks!

Probably the simplest import format would be HTML. Just set convert=true and you should be good to go.

There is no stand-alone API for creating or manipulating the contents of Google Docs files. As you've found, you can create documents in other formats and import them with the Drive API.
If you don't need to work in Java, the other option is to use Google Apps Script, which provides a service for creating and manipulating Google Docs files. More information in this guide.

Related

Read and Write to Google Sheets using JSON backend

I am trying to accomplish the same as the GitHub link, anyone has experience and can suggest a successful best practice?
Google Apps Script to read JSON and write to sheet
Found it, for Python Python Bookshelf App from a previous stackoverflow article: Reading & Writing JSON file on Google Cloud Storage using Python, I believe there is the same for Java, have to review a bit more Java on Google Cloud Platform

How to grab files from Google Drive with PHP?

I just need a starting place. How would you grab files from Google Drive with PHP? So, you would result in this:
<audio src='Google Drive File'></audio>
I'm just starting programming. Any help would be appreciated...
Are you manually sharing just a few specific files or do you want to fetch the file's link dynamically/using lookups, etc.?
For the first, you can use the Google Drive Direct Link Generator.
The other option is to modify the URL yourself so that something with a shared link like https://drive.google.com/file/d/FILE_ID/edit?usp=sharing becomes https://drive.google.com/uc?export=download&id=FILE_ID.
If purely non-manual and only in PHP, use the Drive SDK for PHP (beta) or via the REST API, has PHP examples.

Convert docx to gdoc ( OpenWithLinks = null ) [duplicate]

I am hoping to programatically open a drive file with a particular app using the Google drive APIs.
The aim is to mimic the GUI drive method of launching an app using the "Open With" context menu for a selected file.
While I can get a list of the available apps using apps list method, the app resource doesn't detail the Open URL as far as I can work out.
Does anyone know if it is possible to obtain the Open URL using the APIs?
I believe if you have the scope set for drive.apps.readonly you should be able to use the File method getOpenWithLinks to discover the URLs. Just testing it now, the getOpenWithLinks method isn't available on the File class. I wonder if it has been deprecated? Certainly I can't find evidence of it being so.
https://developers.google.com/resources/api-libraries/documentation/drive/v2/java/latest/com/google/api/services/drive/model/File.html#getOpenWithLinks()
Revision: the getOpenWithLinks methods are available again in revision 75 of the v2 drive API.

Generating a PDF using Google Docs API

Is it possible to provide HTML for the Google Docs API and have it output as a PDF? As far as I can tell, it seems like it is possible to submit an HTML document to Google Docs, and then have Google Docs convert it to a PDF.
I'm checking the API documentation and it has a lot of information about dealing with PDFs already created, but I'm not seeing anything about creating them.
Also, does it accept CSS styling as well, or is it pure HTML?
Yes, it is, with two requests. You can import the file as a Google Docs, then export it to PDF. Using the Drive API.
https://developers.google.com/drive/v2/reference/files/insert https://developers.google.com/drive/v2/reference/files/get
this is what your saying right?

Google Drive / List files in folder

I have little question. Is there any way (I read API, but maybe...) how to list files in folder using only Google Drive API? I mean without scopes Documents List API.
If I send request GET https://www.googleapis.com/drive/v2/files then I get all files and folders in my Google Drive, but I want to show only files which is inside specific folder.
My english is bad, but I hope you understand me.
If not any way to do this, then I must use Documents List API.
Thanks for answers
PS: I make app in C++/QT for MeeGo and Symbian OS mobile systems
Solved. I must use Search string parameters with =q