SaguiItay
SaguiItay

Reputation: 2215

Downloading native documents from Google Drive

I'd like to download files from Google Drive in their native format, using the Google Drive SDK (in order to perform some manipulation on them, and upload them back to Google Drive).

Obviously, I can use the Export Links to convert to another format (Office, etc.), but that means that the file will be converted from native to Office, and then back to native format (during upload). I'm trying to avoid this, as I expect this will not maintain 100% fidelity.

I've tried the following request:

GET /drive/v2/files/1q7BYvDDYWwXXXXXXXxIxsuby0IrXe5L4?alt=media Authorization: Bearer ya29.XXXXXXXXXXXXXtKVg3P3zg

But the response I got was:

{ "error": { "errors": [ { "domain": "global", "reason": "badRequest", "message": "The specified file does not support the requested alternate representation.", "locationType": "parameter", "location": "alt" } ], "code": 400, "message": "The specified file does not support the requested alternate representation." } }

Not being able to get the content of a file in its native format is a big "hole" in the Drive API.

Upvotes: 1

Views: 329

Answers (1)

pinoyyid
pinoyyid

Reputation: 22316

It's not possible to download Google Docs in their native format. Your only choice is export to HTML , Word, odt, etc and then re-import.

Upvotes: 1

Related Questions