0

I am using the sample code of googledrive and I am creating an empty file like:

MetadataChangeSet metadataChangeSet = new MetadataChangeSet.Builder()
   .setMimeType(MIME_TYPE).build();

IntentSender intentSender = Drive.DriveApi.newCreateFileActivityBuilder()
   .setInitialMetadata(metadataChangeSet)
   .setInitialDriveContents(null /*or result.getDriveContents()*/) //both same results
   .build(getGoogleApiClient());

startIntentSenderForResult(intentSender, REQUEST_CODE_CREATOR, null, 0, 0, 0);

For MIME_TYPE = "text/html" the code works as expected onActivityResult I get resultCode -> RESULT_OK intent with extras the DriveId of the created file. And if I browse my Google Drive I see the created file.

But when I change the MIME_TYPE = "application/vnd.google-apps.spreadsheet" in order to create an empty Spreadsheet then the resultCode -> RESULT_CANCELED with null intent and no file is created.

Do I need any extra parameter for the spreadsheet? Why it's not created?

Documentation mentions that the Spreadsheet API cannot create a file but you can use the Drive API for that.

1 Answer 1

1

At the moment you cannot create/edit Google Docs files with GDAA. To do this you will have to use the REST API.

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

2 Comments

Any known 3rd party library for that? Or do I have to implement all the connectivity with the API? That is a huge task.
You can use the java client library so you don't have to implement it yourself. You will have to make handle Auth differently than when using the REST client library though. The following link should get you started developers.google.com/drive/web/quickstart/android

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.