Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Google Sheet document as a deck #8

Open
Co2p opened this issue Oct 25, 2015 · 5 comments
Open

Import Google Sheet document as a deck #8

Co2p opened this issue Oct 25, 2015 · 5 comments

Comments

@Co2p
Copy link

Co2p commented Oct 25, 2015

Import Google Sheet document as a deck.
First column is the question and second column is the answer with the rows representing one card per row

@Co2p
Copy link
Author

Co2p commented Oct 27, 2015

@arturdryomov
Copy link
Owner

Google Sheets does not have any usable API as far as I know. Google Drive API operates on the file-level, basically excluding any content manipulations.

@Co2p
Copy link
Author

Co2p commented Oct 27, 2015

I'm going to take a look at it, see if it's possible. I think it would allow easier editing and sharing of decks, but like you said it might not work.

@arturdryomov
Copy link
Owner

I’ll probably list options available at this point. In the process of writing them down I decided that maybe it is time to revisit some of them. Anyway.

GData Java Client

Provides APIs in the ready-to-use format, but essentially is deprecated in favour of Google APIs Client for Java.

Google APIs Client for Java

Kind of actively developed, but has two major downfalls.

  • Is not integrated with Google Play Services, which kind of breaks great integration with the OS and just user flow.
  • Sheets APIs are not generated, i. e. I have to implement API mostly on my own which essentially is a bunch of very confusing XML. Actually I tried this way some time ago, but there were major performance issues—in other words, filling one sheet with two columns and a hundred lines could take like a whole minute, which is not acceptable in any way. This could have been changed though.

Google Play Services

It is mostly nice and is used for the current backup file-based system. Unfortunately Drive API there operates only on file-level, i. e. I have no access to any structural data in either Docs, Sheets or whatever.

Conversion

Basically create a MS Office or OpenDocument sheet and upload or download it from Drive with conversion to or from the native Sheet. But this solution is not perfect as well—there are not many thin and not bloated Java libraries which afford sheet file creation and parsing. Plus, there are weird limitations, like both .xslx and .ods will limit sheet name to 31 symbols no matter what and libraries actually follow these rules. Damn, just try to create a Google Sheet, name a sheet inside the document with 50 symbols, then download it as Microsoft Excel and OpenDocument, then upload it to Google Drive and choose Open with Google Sheets at the context menu. Both imported documents will truncate the sheet name length from 50 symbols to 31. Because reasons.

Dumb Conversion

Treat each deck contents as a CSV file and all decks as a directory with CSV files. But I really, really hate this solution. One of main goals of Gambit is simplicity. This solution is against any end user good UX at all. Even personally I don’t want to know about any files when I can edit it either online or as a one modern format—like .ods or .xlsx.

@Co2p
Copy link
Author

Co2p commented Oct 27, 2015

looks like you can use a combination of the Drive API (for deleting and creating files) the Sheets API for modifying data and there seems to be a API client to help, I'll have a go and make a pull request if i manage.

Links:
https://developers.google.com/drive/android/create-file
https://developers.google.com/google-apps/spreadsheets/setup
https://github.com/google/google-api-java-client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants