dumbmatter
dumbmatter

Reputation: 9683

Easily saving content generated in client-side JS to a file in Google Drive

If you want to allow users to save a file on your website to Google Drive, it's ridiculously simple. Just use the Save to Drive Button and in a few lines of code, everything is taken care of. Great.

I want exactly that behavior for my website. However, I want to save user-generated text there, rather than a static file sitting on my server. I have the text in a JavaScript variable, but it seems there's no way to use the easy Save to Drive Button with that. The documentation states that "Data URIs ... are not supported" and my testing indicates that object URLs are similarly unsupported (this guy found the same thing).

I am aware that, in theory, it should be possible to use the Google Drive API to do what I want. This question and this question provide some hints at how that might maybe work, but it all seems incredibly complicated (nobody has even made a demo showing that it actually works, AFAICT).

I don't want to have to deal with user logins, sessions, API keys, authorization, permissions, having users "install" my app within Google Drive, etc. I just want a button someone can press to store some text from a JS variable in a new document. Exactly how the Save to Drive Button works. Is this even remotely feasible?

It's not just about complexity on my end, it's about complexity for my users. I want to provide them a very simple, self contained functionality. I don't want my app to be deeply intertwined with Google Drive.

Upvotes: 8

Views: 3320

Answers (1)

Eric Koleda
Eric Koleda

Reputation: 12673

Unfortunately this is not possible today. The Save to Drive button tries to simplify a common use case, but for more specialized use cases like your's you'll need to develop against the API directly.

Upvotes: 2

Related Questions