Programmatically read comments on a Google Docs? - java

I have a client who wishes to create a program that compiles a list of comments from Google Docs. Is there a way to access Google Doc's comments through a scraper or perhaps an official API? I tried using JSOUP to get the information, but Google states that "javascript is unsupported on you browser" resulting in no text being generated. Any ideas for how to programmatically get a list of comments?

Use Drive API's comments resource to list the comments of a doc, samples and reference are available on https://developers.google.com/drive/v2/reference/comments/list

Related

Retrieve just the intro text in Wikipedia

How can I retrieve just the intro text (those few lines at the beginning of each article), using java?
I've seen a question like this here, the problem is that the code was in PHP and I need it in java so I can implement it to my android app...
I've tried to search all GitHub for some easy libraries that could help me get what I want and I got no success.
I've also seen that this link: https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=Stack%20Overflow shows information about whatever I want to search. I just can't retrieve the data because, as I said, in that question, the code posted was in PHP
check this https://www.mediawiki.org/api/rest_v1/#!/Page_content/get_page_summary_title
Api for accessing content is here , rest you can normally parse the data.
hope this helps.

How to get the file id querying the Google drive using Google drive Java Client Library

I ame making an System App for Google in android.which shares files from one Google account to another Google account.
As we know Android drive API have limited support for sharing operation.
For this purpose we are using Google APIs JAVA client.Now our problem is that we can not able to query the drive to get the folder id.
Also how can i query for files.Any one having any example like passing the query parameter "q".
Note:-I am using google-api-client-1.19.0.jar.
Anybody having some idea about this issue,please help us to resolve this issue.
It seems to me your question is "how can I query Drive?"
I was in a very similar situation. your link is very close to revealing how to do this... Yet it does not. I only found this out by looking at Google's JavaDocs and seeing the method signature.
Use the code from the link you shared, but add setQ("My query string for searching") to the .list() call. Example:
Files.List request = service.files().list().setQ("my query string for searching files in Drive");
FileList files = request.execute();
Documentation on what can go into the .setQ()
To Google:
There are clear issues with Google Drive's docs. The only close example in Google Drive's docs is for retrieving ALL the files in Drive. Gee, that's useful. Why is there NO example of passing a query to Drive??? Should we really need to sleuth the Java DOCs for such an obvious / primary feature? And it speaks to the level of the Drive team's community engagement that no one has answered this question.

How to edit native google documents programmatically? [duplicate]

This question already has answers here:
How to programmatically manipulate native google doc files
(2 answers)
Closed 3 months ago.
I found few quite depressive QA here which mentioned that google documents cannot be modified programmatically in Google Drive API - there`s just upload/download option.
I checked those similar topics :
How to programmatically manipulate native google doc files
How do you create a document in Google Docs programmatically?
As I suppose we cannot download and upload directly native google doc formats. Is there any other way how to solve this requirement ?
Has anyone tried to trigger google app script programmatically on selected document, is that possible ? Is possible to start google app script programmatically with some parameters on the input ?
I just need to replace few pieces of text in native google doc`s but i cannot use download->modify->upload (e.g. with formats word/html/pdf) flow as i would broken formatting of pictures,borders etc... (customer requirement : full google integration no proprietary formats)
Do you have any innovative ideas or tips which would be good to explore ?
We are trying to use Google Drive as some kind of very simple templating system (~ thousands of users, hundreds of google documents) but it seems to be a really wrong idea as there is a lot of limitations on the way.
You can't use the Drive API to programmatically manage the content of a Google Document but you can use the Document Service in Apps Script to perform text replacing and other editing:
https://developers.google.com/apps-script/service_document
We invoke google app script deployed on the same domain as webapp which changes content of documents before we download them to proprietary format. We are just replacing few strings nothing complex.
This solution works but its a bit fragile (you have to install g app script + google app engine app in one domain), we are not sure how quickly are changes propagated after you trigger script so we wait always small amount of time e.g. 10 seconds before we try to download modified document.
Important disadvantage is that you cannot invoke GScript from localhost so development is a bit slower as we have to upload our app each time into google app engine.
Nowadays it's possible to use Java and other programming languages without having to use Google Apps Script by using the Google Docs API.
Also it is possible by using execute Google Apps Script code from other programming platforms by using Google Apps Script API, but it doesn't work with service accounts.
Notes:
There are some features available in the Google Docs user interface that aren't available in the Google Docs API.
Inserting content inside tables, that have rows and columns of different sizes might be complex due to the way that the indices work. Something that might help is to build the document from bottom to top.

using google maps in the java app

I want to use google maps in my java web app. What i want is when a user visits a particular page his location be showed in the map with its ip address as the input. Is it possible ?
Also the map should be able to locate the position the user entered in the text-field. How can i do that ?
I even downloaded http://code.google.com/p/gdata-java-client/downloads/list the jar files,samples from the link but they don't work as some of the packages are missing like com.google.gdata.util .
I have used Google maps more on the Javascript side.
And i always find Google Playground to be the best tutor in helping out.
Check it out.
You'll have to use JavaScript to use the Google Maps API. Here's a sample of using HTML5 geolocation to find someone's location: http://html5demos.com/geo
For user input, you might check out using the Google Maps API Places Library which has an autocomplete function: https://developers.google.com/maps/documentation/javascript/places#places_autocomplete

Duplicate Google Spreadsheet on Demand

I've created a pretty complex Google spreadsheet. I would like a user to be able to click a button or follow a link, and get a copy of this spreadsheet where they can fill in data. I would later check process this data manually.
Is there anyway I can do this via a complicated link, or some Javascript, or possibly even using a server side language (e.g. Python, Java).
Thank you,
You have a few options:
Rather than force a user to create a spreadsheet that you verify, you can email them a form to fill out with Google forms, and the answers get aggregated back on your spreadsheet.
Use the docs API to copy documents.
Use Google Apps Script to automate the process (it's essentially javascript).
Copying the document from the client side:
http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#CopyingDocs
Using the Java API, it would seem you'd have to export the document and then upload it:
http://code.google.com/apis/documents/docs/3.0/developers_guide_java.html

Categories