0

i want to create a New Spreadsheet using Java(Google App Engine)

I am passing a json string to my servlet.What i want this servlet to do is: 1.authorize/authenticate using oauth2 2. create a spreadsheet of this data on google drive

All the library combinations are so confusing,which library should i uae for which purpose. Gdata.., drive-api jar, oauth jar,sheets api. I read the sheets APi,which clearly mentions that to creata a New Spreadaheet i should use Drive API

Please point me in right direction.

0

1 Answer 1

1

You need to authorize your requests to Google APIs using OAuth2: https://developers.google.com/identity/protocols/OAuth2

You need the Drive API to create sheets and save them to Drive: https://developers.google.com/drive/

You need the Sheets API to work with the actual spreadsheets (editing the file): https://developers.google.com/google-apps/spreadsheets/?hl=en

Sign up to request clarification or add additional context in comments.

8 Comments

1. how do i authorize my Google API calls using oauth2. i want to use my gmail credentials,or wat else should i use for server to server communication 2. Can you show me some sample code on how to use the oauth to hit the Drive APi to create spreadsheet
If you read the Drive API link, there is a step by step tutorial there on how to set up OAuth2. Any Google account credential will work (so gmail is fine). There are also tutorials for using spreadsheets after you setup OAuth in the sheets link I posted. The last two links both have good tutorials on how to set up OAuth2, access Drive, and create a spreadsheet. You need to read through those websites.
Thanks for the help.I have one more query, looking through the docs ,i checked i have to use OFFLINE mode to authenticate my application to access Google API.Its mentioned i have to exchange the "authorization code" for the "access token". How will i get this authorization code? i am not sure about this
its all in those drive auth section in the official docs. also google more to understand what is oauth.
@zee I haven't used that so I'm not sure, but we can refer to Zigs comment (thanks Zig)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.