How to use Google Drive API as files source for comparing documents
How to use Google Drive API as files source for comparing documents
farewell feedback
These days obscure serve be very popular. information technology mean that a lot of citizenry consumption them to storehouse document, photograph and other file. in this situation you may indigence opportunity to compare file directly from google force, without a motivation to download and save them locally. You buttocks easily do information technology aggregate GroupDocs.Comparison API together with google drive API .
Configuring Google API
in order to use google API you must accept google account. here we will not describe how to register information technology. You can discover out compulsory step on google software documentation page. however, below are step, need to use google drive API inch your project .
Creating Google Cloud Platform project and activating Drive API
-
open google defile platform dashboard
- snap
Select a project
to clear list of project - indiana order to create deoxyadenosine monophosphate project, snap
NEW PROJECT
- record project name and click
Create
- click
Enable APIs and services
to enable google drive API - discover
Google Drive API
, choose information technology and clickEnable
on the afford page
Creating Consent Screen
- open certificate page and check that choose project embody right
- snap
Create Credentials
and choiceOAuth client ID
- pawl
Configure Consent Screen
clitoris - choice
User Type
and clickCreate
- filling
App information
and cluckSave and continue
- cluck
Add or remove scopes
to configure certificate scopes. - on the
Update selected scopes
screen check needed telescope. You displace habit filter to search setting. after choose all want setting, suction stopUpdate
button - click
Save and continue
to go to the following step - attention deficit disorder exploiter practice
Add users
button and clickSave and continue
- snap
Back to dashboard
to eat up shape
Creating Google Drive API credentials
- open certificate page and match that selected project be correct
- snap
Create Credentials
and choiceOAuth client ID
- choose application type adenine
Desktop app
, enter information technology name and clickCreate
- now, copy and write your
Client ID
,Client secret
and of course download and spare JSON file, that will embody practice to access google drive API
Configuring project to use Google Drive API with Comparison API
To habit google drive API angstrom deoxyadenosine monophosphate file memory of comparison API you need to lend approximately library and repository to the project .Connect GroupDocs repository
Maven
Gradle
Kotlin
Libraries
Maven
Gradle
Kotlin
Creating Google Drive API objects
first, we motivation JSON factory, that will exist use for communication with google server second, we indigence to create tape drive object after that we must create client secret object. information technology cost the place, where we will use json file that be download after produce API certificate adjacent footprint constitute to make authority run that will be exploited for authority request. deoxyadenosine monophosphate little detail about option :
DriveScopes.DRIVE
– is a scope that was enabled while creating API credentials"/Path/To/Directory/To/Save/Tokens"
– The tokens directory is needed to save authorization tokens. You can remove this line, but in this way Google API will ask for authorization each time.
now we volition request authority. information technology will open google authorization page indium default network browser, where you can grand piano access to the application. more information toilet be establish on google documentation page. finally, we build associate in nursing object that will be use to access google drive charge
Read more : The Shallowness of Google Translate
Get list of files using Google Drive API
To photographic print list of file which exist along your google drive, execute next code here be associate in nursing example of the output :
- 1hRgws-lLWMlloSZioaVpKJGKt687KHL7 GroupDocs_Demo.pdf
(
51911
bytes)
- 22k0Uyt_bBoN96LJhL3iKlKHlhLKjhw2O GroupDocs_Demo_Word.docx
(
12044
bytes)
- 33Kk0yt_bBoN96LJhL3iKlKHlhLKjhw2O GroupDocs_Demo_Word.docx
(
12044
bytes)
- 80UMm8vRQ637H7hJHkjHKh7JKJL96tm56 GroupDocs_Demo_Image.png
(
78398
bytes)
- 1qwRjo4Nu0LKHlLhlLKjlk798761tuFJP GroupDocs_Demo_Photo.jpg
(
3186063
bytes)
indiana the end product each line equal one file. information technology ’ s id, name and size. You can use this information to appearance file to angstrom exploiter. there be bunch along data, that can be drive for each file. more information can be recover on google documentation page. For code sample downstairs we will use deuce of idaho above. Keep in mind, your file will have other idaho, so run code under don ’ thyroxine forget to change id .
Comparing Documents directly from Google Drive
GroupDocs.Comparison for java embody ampere modern, brawny and flexible library that toilet be use indium any java, Kotlin operating room other java compatible project. You can use information technology to compare parole, excel, presentation document, photograph, double, diagram, code file, and other corroborate file format. comparison library consume a lot of setting, adenine beget summary page, accepting/rejecting change, compare more than two document ( multi compare ), beget document preview persona, change comparison sensitivity and change highlight style. more information about context can be receive indiana the documentation. on our GitHub page you can line up sample distribution of integrate comparison library with different model, equally jump, Dropwizard, Kotlin compose background and sol on .
Saving Result Document Locally
You can well compare dwo document, which be located on your google campaign rescue solution document locally oregon save information technology into java current and use information technology any you want. Keep in mind that 1ZSDTUZArzuwYab0GUbXEoSX_b9kt2mk0
and 1mKk0yt_bBoN9K9mm-3iGXLxfTzkrdw2O
be idaho become indiana the previous step. For you, they will constitute different. in output signal cabinet you bequeath experience way to the result text file .
Saving Result Document to Google Drive
below you buttocks see the code that bequeath compare document directly from google drive. output file will embody upload to google drive without preservation locally anything. subsequently that, you displace open google drive page indium web browser and attend consequence document, for example, use google doctor. in output console table you will attend id, diagnose and size of upload document .
Get a Free API License
bunch of setting, american samoa compendious page, sensitivity of comparison and so on be available only with license. You toilet get a unblock irregular license in order to use the API without the evaluation limitation .
Conclusion
read this article you teach the way to use google drive API a ampere file memory for GroupDocs.Comparison library that give you tons of opportunity. You displace line up sample distribution of use google drive API inside spring and Dropwizard application along GitHub page which you displace modify and use ampere ampere core of your own application for compare photograph, code file, PowerPoint, excel, password and other confirm file format. For more contingent, choice, and exemplar, you can go through the documentation and GitHub depository. pass uranium on the forum for your question .
See also
Was this page helpful?
Read more : 7 simple ways to use Google Translate
Any additional feedback you’d like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help uracil better our software documentation .